Web Hosting Talk







View Full Version : CSS problem


Shaliza
12-01-2007, 11:24 AM
In the stylesheet, I have something like this:

.header {
width:350px;
margin:0px auto;
font-size:50px;
font-color: #FF3366;
font-weight:bold;
text-align:center;
font-family: Tahoma, Monospace, Arial, System;
line-height: 70%;
}

.header2 {
width: 350px;
margin: 0px auto;
font-size: 50px;
font-color: #000;
font-weight: bold;
text-align: center;
font-family: Tahoma, Monospace, Arial, System;
line-height: 70%;
}

.header3 {
margin: 0px auto;
padding-top: 10px;
width: 70%;
font-family: Tahoma, Monospace, Arial, System;
text-align: center;
font-size: 120%;
line-height: 120%;
}

.subhead {
padding-top: 5px;
letter-spacing: -1px;
line-height: 100%;
font-family: Tahoma, Monospace, Arial, System;
font-size: 110%;
font-weight: bold;
}


And on the page:


<div class="header">content</div><br>
<div class="header2">content</div><br>
<div class="header3">content</div><br>
<div class="subhead">content</div>


However, the code isn't showing up right on the page at all. There's a massive space in-between the first/second headers & the third header. The subhead is too far down there are spaces in-between. The whole thing looks screwy.

Anyone know what the problem might be?

cofcpologuy
12-01-2007, 12:12 PM
I checked this in IE 7.0 and Mozilla 2.0 and it removed the extra spacing.

Have you considered removing the <br> tags and adjusting the padding-top for header3 and the subhead?

Let me know if this isn't what you were looking for and I'll take another look at it.

Hope this helps.

flakdesign
12-01-2007, 02:24 PM
hey Shaliza (http://www.webhostingtalk.com/member.php?u=109648), can u tell us what your trying to achieve? If you are using IE, are you in quirks mode or standards mode?
Remove the line breaks, Div are blocks and not inline so <br /> tag is redundant, but if you want it to float you can use css float property.

tell me what ur trying to do, and i will guide you.

stripeyteapot
12-01-2007, 03:09 PM
Just to add to the above post - You don't need to set your font-family over and over when it's the same. Simply apply the rule to your HTML or BODY tag.

Shaliza
12-02-2007, 09:40 AM
Here's what I'm trying to do:

www.official-tycp.com/test

The first one I used div style & the second is in a stylesheet. The first one is obviously what I'm trying to do. I can't figure out why it works in div style but not in a stylesheet. Maybe I should just use the div style?

rmfred
12-02-2007, 01:42 PM
Don't use div style... keep your css in an external stylesheet. Then get yourself a doctype for your page.. and based on how you're closing some tags it looks like you are attempting to use xhtml?
Then get rid of the deprecated tags such as <center>
Then get rid of all the br tags... rely on padding or margins instead.
Last but not least, either stick with an external stylesheet (preferred) and get rid of the inline css or keep the inline and don't call the external sheet.

Shaliza
12-03-2007, 11:38 AM
The page I posted is an example. It is not the actual page I'm using.

I almost give up on this.