Div Not Filling Page?

N

nickolas80

I have a DIV which I want to completely go from one side of the page to
the other, with not whitespace or margins. I can not seem to get it to
work, it is flush on the left, but leaves about 15px of whitespace on
the right side.

Here is my CSS:

#MidBar {
position: absolute;
height: 50px;
width: 100%;
left: 0px;
top: 110px;
background-color: #0066CC;
right: 0px;
}

and my div:

<div class="MidBar" id="MidBar"></div>


any suggestions?
 
E

Els

I have a DIV which I want to completely go from one side of the page to
the other, with not whitespace or margins. I can not seem to get it to
work, it is flush on the left, but leaves about 15px of whitespace on
the right side.

Here is my CSS:

#MidBar {
position: absolute;
height: 50px;
width: 100%;
left: 0px;
top: 110px;
background-color: #0066CC;
right: 0px;
}

and my div:

<div class="MidBar" id="MidBar"></div>

any suggestions?

Yes, I have two.
One: leave out the width, and the 'right' property. Any div by default
automagically stretches to 100% of what's the available width for it.
Two: the 15px space is probably the padding or margin on <html> or
<body>.
Add this to your styles:
html,body{margin:0;padding:0;}
and see if that helps. If it doesn't, you'll need to show an actual
example of your problem, for further investigation :)

(and Three: I hope this div isn't meant to have text in it, and also
doesn't have text above it)
 
N

Neredbojias

With neither quill nor qualm, (e-mail address removed) quothed:
I have a DIV which I want to completely go from one side of the page to
the other, with not whitespace or margins. I can not seem to get it to
work, it is flush on the left, but leaves about 15px of whitespace on
the right side.

Here is my CSS:

#MidBar {
position: absolute;
height: 50px;
width: 100%;
left: 0px;
top: 110px;
background-color: #0066CC;
right: 0px;
}

and my div:

<div class="MidBar" id="MidBar"></div>


any suggestions?

Did you check in more than 1 browser and see the same effect? Els
suggestion of setting the margins and padding to 0 is a must, but IE can
react strangely to some css.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top