By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,739 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,739 IT Pros & Developers. It's quick & easy.

DIV & CSS style - applied to tag works - using css fails!

P: n/a
Hi all,

I have this irritating problem. I cannot use tables and I need to
format text in columns.

I decided that DIV would serve the purpose and set about learning a few
properties for them.

When I apply properties to the DIV tag direct, the display is correct.
When I use a CSS stylesheet, the display is incorrect. Please can
someone help / point me in the right direction?

HERE IS MY CODE:
Applied directly to DIV TAG
<div style="background-color:#003366; color: #ffffff; float: left;
position: relative; padding-left: 10px; width: 120px;"><a
href="browse.php">Description</a></div>
<div style="background-color:#003366; color: #ffffff; float: left;
position: relative; padding-left: 10px; width: 30px;"><a
href=\"edit.php">[edit]</a></div>

Using CSS:

stylesheet:
..make_column {
background-color: #003366;
color: #ffffff;
float: left;
position: relative;
padding-left: 10px;
width: 120px
}

html page:
<div class="make_column"><a href="browse.php">Description</a></div>
<div class="make_column"><a href=\"edit.php">[edit]</a></div>
The results (as you will see) are that when using the stylesheet, the
columns continue on the next HALF line resulting in:

description

Jan 24 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 24 Jan, 11:01, "Frobinrobin" <frobinro...@hotmail.comwrote:
I cannot use tables and I need to format text in columns.
Of course you can use <table>s if that's what's appropriate.

When I apply properties to the DIV tag direct, the display is correct.
When I use a CSS stylesheet, the display is incorrect. Please can
someone help / point me in the right direction?
This is probably some tedious syntax problem that we could solve in
seconds if only you'd told us where the site was. This sort of bug
isn't fixable from snippets though.
HERE IS MY CODE:
We don't care. Give us a URL.

It looks as if the HTML needs changing a little though. You need
different behaviour on the column cells, as the leftmost needs a
clear:left; as well. Using the same class on both makes this hard to
apply.

Jan 24 '07 #2

P: n/a
Frobinrobin wrote:
Hi all,

I have this irritating problem. I cannot use tables and I need to
format text in columns.

I decided that DIV would serve the purpose and set about learning a few
properties for them.

When I apply properties to the DIV tag direct, the display is correct.
When I use a CSS stylesheet, the display is incorrect. Please can
someone help / point me in the right direction?

HERE IS MY CODE:
Applied directly to DIV TAG
<div style="background-color:#003366; color: #ffffff; float: left;
position: relative; padding-left: 10px; width: 120px;"><a
href="browse.php">Description</a></div>
<div style="background-color:#003366; color: #ffffff; float: left;
position: relative; padding-left: 10px; width: 30px;"><a
href=\"edit.php">[edit]</a></div>

Using CSS:

stylesheet:
.make_column {
background-color: #003366;
color: #ffffff;
float: left;
position: relative;
padding-left: 10px;
width: 120px
}

html page:
<div class="make_column"><a href="browse.php">Description</a></div>
<div class="make_column"><a href=\"edit.php">[edit]</a></div>
The results (as you will see) are that when using the stylesheet, the
columns continue on the next HALF line resulting in:

description
For tabular displays (e.g., data in columns), tables might indeed be
okay. However, for creating two parallel columns, see my
<http://www.rossde.com/PGP/pgp_keysign.html>, where both the table of
contents and the lists of cities are in columns formatted via <divand
CSS.

--

David E. Ross
<http://www.rossde.com/>

Concerned about someone (e.g., Pres. Bush) snooping
into your E-mail? Use PGP.
See my <http://www.rossde.com/PGP/>
Jan 24 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.