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
Trouble vertically positioning h1 text in a div? help!
Old 08-10-2006, 05:28 PM Trouble vertically positioning h1 text in a div? help!
Average Talker

Posts: 25
Trades: 0
Just starting on laying out a web design and I have not been able to find a way to get a h1- text line located in the vertical center of the header div.

Have tried using a top-margin value on the h1 tag itself using CSS, but this drops the entire header & container down without effecting the vertical h1 location inside the header div.

Note:
Having no trouble aligning the h1 text horizonally using the left margin settings in CSS.

What should I do to get the h1 text aligned vertically at about 62px below the top of the header div?

Am using Firefox to check my layout.


HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="fmscss.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>
<div id="container">

<div id="header">
<h1>fullmoonsphinx.net</h1>
</div>

</div>

</body>
</html>
************************************************** ********


CSS
body {
margin-top: 20px;
margin-bottom: 20px;
padding: 0;
background: #777777;
}
#container{
position:relative;
margin:0 auto;
padding:0;
width:740px;
}
#header {
width: 100%;
height: 125px;
background: #000000 url(images/logo/logo.jpg) top left no-repeat;
}
#header h1 {
margin-top: 62px; <---- getting unusual effects using this setting
margin-left: 180px; <---- horizontal placement works fine
padding: 0;
font-family: Arial, Helvetica, sans-serif; font-variant: small-caps;
font-size: 1.8em;
color: White;
}
stevefarillo is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-10-2006, 06:28 PM Re: Trouble vertically positioning h1 text in a div? help!
b0881's Avatar
Super Talker

Posts: 112
Name: Bobby
Trades: 0
Instead of using margin-top and margin-left try:

margin: 62px 0px 0px 180px;
b0881 is offline
Reply With Quote
View Public Profile
 
Old 08-10-2006, 09:11 PM Re: Trouble vertically positioning h1 text in a div? help!
Average Talker

Posts: 25
Trades: 0
Didn't make any difference using the CSS shortcut method.
margin: 62px 0px 0px 180px;

When I change the margin-top value (62px) to anything but 0, it lowers both the container & header div that value of pixels. Has no effect at all on the h1 positioning.

Not understanding why this is happening to tell you the truth.

Anybody have another idea on what the problem may be here?
stevefarillo is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Trouble vertically positioning h1 text in a div? help!
 

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.19068 seconds with 12 queries