Forum Moderators: not2easy

Message Too Old, No Replies

Help with CSS

Header and Logo not aligning.

         

kaymeis

10:44 am on Nov 4, 2009 (gmt 0)

10+ Year Member



hi all,

I'm trying to align my logo to the left of my header, using the float tag.Instead, the logo floated to the right of the header Why is that?

here is the code for CSS and HTML

CSS

body{background-color:ffffff;
}

.foo { font-family: Roman;
font-size:24px;
color: #66ccff;
font-style: italic;
float:left;
}
.img{url:bar.gif
width:63
height:40;

}
A:link(color:blue;
}
A:visited(color:blue;
}

.attamain{width:250px;
padding:10px;
border:5px solid grey;
margin:10px;
background-color:000000;

}

HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>

<title> Your Title Here </title>
<link rel="stylesheet" type="text/css" href="atk.css">
<meta name="Description" content="Your description here...">
<meta name="Keywords" content="Your keywords here...">
</head>

<body>
<h1 class="foo">bar <h1/>

<img src="foobar.gif" width="63" height="40"border="0" alt="foobar"class="img" />
<div class="attamain">
</div>

</body>
</html>

[edited by: swa66 at 12:15 pm (utc) on Nov. 4, 2009]
[edit reason] examplified [/edit]

swa66

12:13 pm on Nov 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First try validating your CSS:
e.g.:

.img{url:bar.gif
width:63
height:40;
}

is gibberish.
I might find what you meant to do, a browser will not see through the syntax errors.

Similarly: validate your html.
(get a full doctype to start with)
<h1 class="foo">bar<h1/> isn't making sense the browser will try to make sense out of the tag soup, I'm not into guessing what the browsers out there might conclude it means, too many of them and too weird ones out there.

font-family: Roman;
A font family is a list of fonts, with at the end a generic font.
e.g.:
font-family: Roman, sans-serif;

(or make it serif, depending on what that Roman font is, I don't seem to have it)

After you fix that, take a good look where you apply the float to.