terryds Posted April 26, 2013 Share Posted April 26, 2013 (edited) Good morning...I want to make a headerwrap like this site headerbar...Mine is below 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 April 26, 2013 by terryds Link to comment Share on other sites More sharing options...
Ingolme Posted April 26, 2013 Share Posted April 26, 2013 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. 1 Link to comment Share on other sites More sharing options...
michaelsavior5 Posted May 12, 2013 Share Posted May 12, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now