Solved

HTML Div whole page

Posted on 2010-11-23
3
406 Views
Last Modified: 2012-05-10
Hi,

I would like to have a div at the top which spans the whole page. What is the best way of doing this? I end up with margins. I have something that works IE8/ firefox but not IE7 .

#top{
      width:100%;
      height:50px;
      background-color:#900;
float: left;
      margin-top:-8px;
      margin-left:-8px;
      border-right:20px;
      border-right-color:#900;
      border-right-style:double;

}
0
Comment
Question by:wilflife
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Accepted Solution

by:
Zado earned 200 total points
ID: 34201487
Try this:

#top {
  position:absolute;
  top:0;
  left:0;
  right:auto;
  width:100%;
  height:50px;
  background-color:#900;
  border-right:double 20px #900;
}
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 total points
ID: 34201746
A <div> has a default width of 100% of what ever 'container' it is in.  You may have to add a CSS definition for the body to have "margin: 0;" to get rid of the default margins for the body.
body {margin: 0;}

Open in new window

0
 
LVL 9

Assisted Solution

by:darkapple
darkapple earned 200 total points
ID: 34202517
Try once this

*{
    padding:0;
    margin:0;
}

#top{
      width:100%;
      height:50px;
      background-color:#900;
      border-right:20px;
      border-right-color:#900;
      border-right-style:double;
      position:absolute;
}
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question