|
|||||||
| CSS Discussion and technical support relating to Cascading Style Sheets. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ok, I understand that this issue has been overwhelmingly covered already, but I have been browsing the forum for hours now and just can't seem to fix my problem.
Thing is, I centered a div (container) and the high-child div (banner) works fine, but the to bottom ones (left and right) keep floating away from the parent-div's width. I am really new to all this and any help would be fully apreciated. The .css file: Code:
body {
cursor:default;
margin: 0;
text-align: center;
}
#container {
position: relative;
width: 810px;
margin: 0 auto;
border-spacing: 0px 0px;
right: auto;
left: auto;
clear: left;
padding: 0;
}
#banner {
width: 800px;
height: 310px;
margin: 0;
border-color: #999999;
color: #ffffff;
font: 8pt 'Lucida Grande', LucidaGrande, Lucida, Helvetica, Arial, sans-serif;
padding-top: 0px;
padding-bottom: 0px;
text-align: left;
}
#left {
width: 400px;
margin: 0;
padding: 0;
float: left;
}
#right {
margin: 0;
padding: 0 0 0 0px;
border-left: dashed #666666 2px;
float: right;
width: 200px;
}
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>:eveRlasT .//</title> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <link href="stylish.css" rel="stylesheet" title="stylish.css" type="text/css" /> </head> <body> <div class="container"> <div class="banner"><img src="interface/banners/random.php"></div> <div id="left">lteste</div> <div id="right">rteste</div> </div> </body> </html> |
|
#2
|
||||
|
||||
|
first, class is referenced in the stylesheet as . (period) and id as # (hash)
therefore change your stylesheet (or html) to reflect this. ie: <div id="container"> is referenced in the CSS as #container <div class="container"> is referenced in the CSS as .container
__________________
The answer to all these questions is Google. Give your thread a useful title | Webdeveloper.com Acceptable Use Policy Something wrong with your code? Validate first! | No Australian Net Censorship! The Australian government is wanting to follow in China's footsteps and "provide" nationwide Internet censorship, don't let them! |
|
#3
|
||||
|
||||
|
Well the first two divs should have ids, not classes.
__________________
Help Save Ana Why use Web Standards: Zeldman How (new): Castro How (experienced): Cederholm If you can only get one book and you're already HTML savvy then this is it: stylin' with CSS: A Designer's Guide Charles Wyke-Smith New Riders "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan |
|
#4
|
|||
|
|||
|
Holy crap! That was effective.
Geez, I'ma have some trouble til I actually learn this thing... Well, thanks a lot, I am very thankful for your help (though it made me look stupid ) and I shall now proceed to further headaches.PS: it is comforting to know that I can get real help online, I'll try not to post stupid questions in the future... |
|
#5
|
||||
|
||||
|
No problem. While we are on the issue of 'id vs class' maybe you would like to know the differences between them and why you would use one over the other.
http://www.w3.org/TR/html401/struct/...tml#adef-class http://www.webdeveloper.com/forum/sh...d.php?t=109986 http://www.webdeveloper.com/forum/sh...ad.php?t=85247
__________________
The answer to all these questions is Google. Give your thread a useful title | Webdeveloper.com Acceptable Use Policy Something wrong with your code? Validate first! | No Australian Net Censorship! The Australian government is wanting to follow in China's footsteps and "provide" nationwide Internet censorship, don't let them! |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|