Jump to content

Please help on my header bar!


terryds

Recommended Posts

Good morning...I want to make a headerwrap like this site headerbar...Mine is below 357mybo.png Can you make the red box placed at the top and cover all the width (like this w3schools forum's headerbar) This is the code i use

 .headerwrap {width: 100%;height: 50px;background-color: red;margin-left: auto;margin-right: auto;float: left;padding: 0px;}

Thanks for any helps...

Edited by terryds
Link to comment
Share on other sites

As for CSS, you can remove all your margin, float and width declarations. They're not necessary and may even cause some trouble. To ensure it takes the full width of the page put it right under the <body> element. HTML

<body>	<div class="headerwrap">Header</div>

CSS

.headerwrap {height: 50px;background-color: red;}

Be sure that the <body> and <html> elements don't have any default margin or padding.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

The problem is the float. It is not needed if you want the red section on top. If the red section is your header, then in your html let it come first and specify the margin only once like this,.headerwrap{ width:100%; height:50px; margin:0px auto; background-color:red;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...