Div extending beyond width of browser screen

J

Jay

I am trying to create a page where the color of a bar at the top extends
beyond the actual content area. I've used div and span tags to try this with
a width: 100% style but I get horizontal scroll bars. Is there a better way
to do this without the scroll bars?

http://www.pacer.org/zNew/index.htm

Thanks,

- J
 
T

Toby A Inkster

Jay said:
width: 100% style but I get horizontal scroll bars

Do you have any padding, margin or borders on the element that has
width:100%?

space taken up by the element = width + padding + border + margin

Besides which, all that absolute positioning is a recipe for disaster!
 
J

Jay

Toby A Inkster said:
Do you have any padding, margin or borders on the element that has
width:100%?

No, none of the above.
space taken up by the element = width + padding + border + margin

Besides which, all that absolute positioning is a recipe for disaster!

It's just a design prototype to show. It'll be redone with relative
positioning if it's approved. The absolute positioning was easier for me to
get something to show quickly.

- J
 
K

kchayka

rf said:
http://users.bigpond.net.au/rf/test/pacer.jpg

Note, this effect was achieved by simply ignoring font sizes specified in
web pages, something I habbitually do to defeat authors who think they know
better than I what my font size should be :)

Thanks for pointing that out, it's a condition I should test more often.
;) Most font sizes were already close to default anyway so the issues
were easily corrected.

Seems to me this little demo does show that if you are going to invoke
any user styles, you do take some risks simply by overriding some
things, but not all.
 
R

rf

kchayka said:
Thanks for pointing that out, it's a condition I should test more often.
;) Most font sizes were already close to default anyway so the issues
were easily corrected.

Much better:) Now, what about the bannar. That "PACER Center" is very
Seems to me this little demo does show that if you are going to invoke
any user styles, you do take some risks simply by overriding some
things, but not all.

Seems to me that the KISS principle applies. Each time one uses a style rule
or property or an HTML element or attribute one should ask: Why am I doing
this?. If there is not a very positive answer than don't do it.

Look at that banner. Hmmm. There is a div in there enclosing a span, both of
which are styled. This construct is presumably to make the text look
centred both horizontally and vertically. Do we need all of this? Probably
not. A simple

..bannar {text-align: center; height: 2em; padding-top: .4em; font-size:
250%;}

<h1 class="bannar">PACER Center</h1>

works for me.

It degrades better if the viewer has chosen to ignore font sizes. It works
better in aural browsers who can hear that it is a heading element. SE
spiders just may give the words higher importance. It works better in lynx
:)

It is far easier to maintain, the next bloke that looks at the code will see
at a glance what is going on, rather than mentally decoding a div, a span, a
..mhead rule and a .mhead span rule and trying to visualise what the merged
result is going to be (thinks... now what is that line-height actually
doing?).

More importantly, that bloke may just look at the HTML and think: hmmm, that
span isn't needed, I'll just remove it. Bang...

Cheers
Richard.

 
M

Mark Parnell

Sometime around Fri, 12 Dec 2003 05:54:17 GMT, rf is reported to have
stated:
It is far easier to maintain, the next bloke that looks at the code will see
at a glance what is going on, rather than mentally decoding a div, a span, a
.mhead rule and a .mhead span rule and trying to visualise what the merged
result is going to be (thinks... now what is that line-height actually
doing?).

No, the next bloke that looks at the code will probably say, "What's all
this CSS stuff I don't understand?" and rewrite the site with deprecated
markup. :-(

Unless kchayka has carefully selected a replacement like Nico is attempting
to do. :p
 
T

Toby A Inkster

kchayka said:
Seems to me this little demo does show that if you are going to invoke
any user styles, you do take some risks simply by overriding some
things, but not all.

Or from the other POV: it demonstrates the risk in invoking any author
styles.
 
H

Hywel Jenkins

rf said:
http://users.bigpond.net.au/rf/test/pacer.jpg

Note, this effect was achieved by simply ignoring font sizes specified in
web pages, something I habbitually do to defeat authors who think they know
better than I what my font size should be :)

Do many people *really* give a shit? Do many people *really* go out
of the way to do that? WTF do you do when you get a newspaper in the
morning? Do you re-scan it, OCR it, then change the font sizes? FFS!
Bring it on ...
 
R

rf

Hywel Jenkins said:
"rf" <[email protected]> wrote in message

Do many people *really* give a shit? Do many people *really* go out
of the way to do that? WTF do you do when you get a newspaper in the
morning? Do you re-scan it, OCR it, then change the font sizes? FFS!
Bring it on ...

Hmmm. What is your problem with the way I have *my* browser configured?

Newspapers have absolutely nothing to do with this issue. If I can't read a
newspaper I don't buy it.

If I can't read a web page I make my font larger. If the boneheaded author
has tried to prevent me from doing this then I ignore said authors
suggestions. If the site breaks because of this, as this one once did, then
it is the authors fault, not mine.

Remember, the web is one way. It is from author to the potential
viewer/client/buyer. It is up to the author to make this happen, not the
viewer. If the author screws up there is always another site out there.

Cheers
Richard.
 
K

kchayka

rf said:
<h1 class="bannar">PACER Center</h1>

works for me.

I don't agree that logos and mastheads are deserving of h1 markup.
It degrades better if the viewer has chosen to ignore font sizes.

I believe that if a user is clueful enough to invoke user styles of some
kind, they can probably also live with minor display oddities that might
result from their overrides. The content is still accessible and
readable, is it not?
It works
better in aural browsers who can hear that it is a heading element.

I don't believe it _should_ be a heading element.
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top