...

View Full Version : more problems with CSS float



colin8
11-06-2006, 11:46 PM
On my site I am trying to create a conversation, with one person's name styled one way, and the other person's styled another. I made the styles with CSS, but I think I did all my float stuff incorrectly.

Page in question (http://www.pulpingfiction.com/burger.htm)

Obviously I don't want all the "me"s and the "manager"s to be nested, any idea how to fix this?

relevant CSS:

.manager
{
float: left;
font:bold ;
font-size: 14px;
color: #FF6A6A;

}

.me
{
float: left;
font: bold;
font-size: 14px;
color:#3366FF;

}

mark87
11-06-2006, 11:51 PM
You could use clear:left; but you're using div's totally the wrong (semantic) way...

One of the best methods would be to use <span>'s as they are displayed inline by default.

colin8
11-06-2006, 11:56 PM
I changed them to span's, but now all the styles aren't being applied to them. I'm assuming I need to change the css file somehow since I changed the div's to span's, but I'm not quick sure what to do.

mark87
11-06-2006, 11:59 PM
I don't see the change you've made online?

You can keep the CSS just remove the floats, eg.

.manager {
font: bold;
font-size: 14px;
color: #FF6A6A;
}

.me {
font: bold;
font-size: 14px;
color: #36F;
}

Just a note: Font sizes in px won't resize in IE, and (I'm sure you know but) tables should not be used for layout...

colin8
11-07-2006, 12:08 AM
Okay thanks, I realized that I changed my div starting tags, but I forgot to change my close tags...stupid I know.

And I didn't know that the font wont resize in IE with px, should I just use % instead?

And yes I'm quite aware that tables are becoming quite outdated for layouts, I just haven't really had a whole lot of time to really understand exactly how to make a layout purely with CSS. Plus in my web design class we learn basically nothing (literally the teacher asks ME how to do stuff on a regular basis, it's pathetic), so I'm having to learn all this stuff on my own.

mark87
11-07-2006, 12:10 AM
Well em is probably the best way to define a font size value.

Feel free to stick around; ask and learn! ...and check out http://www.w3schools.com/ :)

colin8
11-07-2006, 12:12 AM
That's where I learned HTML 4 years ago, back in 8th grade.

And I just started actually using CSS this year, so I'm way behind the times!

mark87
11-07-2006, 12:19 AM
Hehe well there's quite a good introduction to CSS on w3schools, and many people would also recommend http://www.htmldog.com/ .

The best method in my opinion to learning CSS is just to practice experimenting with layouts etc (I still do!).

colin8
11-07-2006, 12:20 AM
Okay great, thank you very much Mark, you've been a huge help.

mark87
11-07-2006, 12:21 AM
No problem! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum