Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Lady and Adam Css newb has a question.
Old 08-10-2007, 02:18 PM Lady and Adam Css newb has a question.
Defies a Status

Posts: 1,605
Trades: 0
Maybe this is normal and maybe I did something wrong. I am rewriting a site and decided it was time to really learn a little css.

I did a stylesheet and page for a fluid 3 column layout and plugged in a few placeholder words. The divs for the entire page looks like this:

header div
t-banner div
main-left, main, main-right divs
bottom-banner div
footer div


Everything showed up as it should. Then I added content to the main center. All is still good. I used <div align="center"> <div id="div-name"> to center the header and t-banner divs closing each with </div></div>. All is good.

I plugged in some content for the main div and then used the <div align="center"><div id="div-name"> on the bottom banner. When I did this the content in the bottom-banner div became mis-placed and appeared in the main right div.

Once I added content of equal height to the main-right div it appeared where it should be and centered. Is is normal?

link to page
link to stylesheet

Any other comments appreciated.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-10-2007, 02:26 PM Re: Lady and Adam Css newb has a question.
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
Your problem lies in your markup. If you markup the content using XHTML instead of ugly html you have now it should be easier to do what you are trying to accomplish.

Ditch the align=center divs they are completely pointless since you are using CSS and any styling should be done there and not in the markup.

Take a look a these three sites on the subject of using CSS for design, hopefully they can help you.

http://www.subcide.com/tutorials/csslayout/
http://www.alistapart.com/articles/practicalcss/
http://www.glish.com/css/

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
Reply With Quote
View Public Profile Visit JamieLewis's homepage!
 
Old 08-10-2007, 03:43 PM Re: Lady and Adam Css newb has a question.
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
<div align="center">

Nooooooooo!!!!!

In CSS, just set div to float center.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 08-10-2007, 03:53 PM Re: Lady and Adam Css newb has a question.
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
Originally Posted by Learning Newbie View Post
In CSS, just set div to float center.
Is float: center valid css?? I've never seen it used before.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 08-10-2007, 03:55 PM Re: Lady and Adam Css newb has a question.
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Quote:
In CSS, just set div to float center
Umm.. noo.. there is no such thing as 'float: center'.

Using <div align="center"> is the wrong approach, regardless of whether you use XHTML or HTML 4.01 Strict.

The proper method for centering entails 3 things:
1 - give your div to be centered a width
2- In your CSS, set that div to margin: 0 auto;
That will center the div in all browsers except IE 6 and below. For that you must add text-align: center to the <body> or on the container that will hold the div you want centered.

By the way, there is nothing whatsoever wrong with using straight HTML, but do use at least HTML 4.01 Strict.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-10-2007, 04:29 PM Re: Lady and Adam Css newb has a question.
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Actually...it will center the div in IE6. It's IE5.5 and below that the text-align: center; hack is necessary.

Other than that, what LNR said.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-10-2007, 04:42 PM Re: Lady and Adam Css newb has a question.
Defies a Status

Posts: 1,605
Trades: 0
Quote:
Umm.. noo.. there is no such thing as 'float: center'.
I already learned that by trying.

Quote:
Using <div align="center"> is the wrong approach, regardless of whether you use XHTML or HTML 4.01 Strict.
I really appreciate that comment. I copied that from somewhere. Will try your advive.

But everyone missed the real question about why the bottom banner part appeared in the wrong place when there was no content. Or maybe correcting the method will improve the result?

Quote:
I plugged in some content for the main div and then used the <div align="center"><div id="div-name"> on the bottom banner. When I did this the content in the bottom-banner div became mis-placed and appeared in the main right div.

Once I added content of equal height to the main-right div it appeared where it should be and centered. Is is normal?
Thanks to all who took the time to reply.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 08-10-2007, 05:02 PM Re: Lady and Adam Css newb has a question.
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
It is when you don't clear your floats...in this case, your left floats. So what you need to do is use a clearing div (some people use a break, but I find that clearing with a break is erratic) to clear the left float.

Sorry...I didn't really realize that was the question.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-10-2007, 06:15 PM Re: Lady and Adam Css newb has a question.
Defies a Status

Posts: 1,605
Trades: 0
Quote:
It is when you don't clear your floats...in this case, your left floats. So what you need to do is use a clearing div (some people use a break, but I find that clearing with a break is erratic) to clear the left float.
I Googled and read this page. Sorry, I failed to understand it.

http://www.positioniseverything.net/easyclearing.html
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 08-10-2007, 10:06 PM Re: Lady and Adam Css newb has a question.
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
That method is a bit complicated to understand. Try this one:

http://css-discuss.incutio.com/?page=ClearingSpace

I use a <br> for clearing and I've found it to be completely reliable, nothing erratic about it:

.brclear{
clear:both;
height:0;
margin:0;
font-size: 1px;
line-height: 0;
}
Then in the HTML its <br class="brclear" />

What can be tricky to grasp is exactly WHERE to place the clearing element. There are resources in the WIKI that can help you understand that.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Last edited by LadynRed; 08-10-2007 at 10:09 PM..
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-11-2007, 12:29 PM Re: Lady and Adam Css newb has a question.
Defies a Status

Posts: 1,605
Trades: 0
Quote:
I use a <br> for clearing and I've found it to be completely reliable, nothing erratic about it:
THANKS! I found that darned easy to use and it worked kike a charm. The site you linked to alsos explains stuff in nice simple terms that even I can grasp.

I am still stuggling with
Quote:
Using <div align="center"> is the wrong approach,
this one. One thing at a time.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 08-12-2007, 06:27 PM Re: Lady and Adam Css newb has a question.
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You use CSS to align things, centered or otherwise, you don't use the deprecated align=center" - it's presentational, presentation is done with CSS, NOT in the html.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Lady and Adam Css newb has a question.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.66172 seconds with 12 queries