Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

CSS and DIV, trouble overflowing "correctly"

Question posted by: Plater (Moderator) on March 27th, 2008 03:33 PM
I cannot seem to achieve what I want here. It's not a FF vs IE thing because I cannot get it in either.

The heirarchy of my page is effectively:
Code: ( text )
  1. <center>
  2.     <div id="backing" >
  3.         <center>
  4.             <div id="PageAnnouncement" class="PageAnnouncement"  ></div>
  5.         </center>
  6.     </div>
  7. </center>


The goal is to make "PageAnnouncement":
-centered (done: embeded center tag...not sure if that passes standards)
-occupy 90% of the width-space of the "backing" div (done: width=80% in style)

The trouble spot mainly comes in with:
-ONLY overflow downwards and not side-side. I would effectively like the DIV tag to perform some sort of "wrap". I am ok with a scrollbar, but only if it scrolls up/down, not left/right. Even if there is no scrollbar and it grows unbounded downwards, I would be ok with it.

Does anyone have any thoughts on this?
Currently, the style for that DIV is this:
Code: ( text )
  1. padding: 2px;
  2. width: 90%;
  3. overflow: auto;
  4. border-color: Red;
  5. border-width: 3px;
  6. border-style: solid;
  7. border-collapse: collapse;
  8. background-color:Yellow;
  9. font-size: 14px;
  10. font-weight: normal;


I even debated changing that DIV to a readonly textarea, but I need to be able to put basic HTML inside the DIV, plus FF and IE treated textwrapping differently in textareas.
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
drhowarddrfine's Avatar
drhowarddrfine
Expert
4,036 Posts
March 27th, 2008
04:34 PM
#2

Re: CSS and DIV, trouble overflowing "correctly"
Is this what you mean?
Code: ( text )
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2.    "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title></title>
  6. <style type="text/css">
  7. div{
  8. margin:0 auto;
  9. padding:2px;
  10. border: 3px solid red;
  11. border-collapse:collapse;
  12. background-color:yellow;
  13. font-size:14px;
  14. }
  15. #backing{
  16. }
  17.  
  18. #PageAnnouncement{
  19. width: 90%;
  20. overflow: auto;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25.     <div id="backing" >
  26.       <div id="PageAnnouncement" class="PageAnnouncement">
  27.     <p>This is a testThe goal is to make "PageAnnouncement":
  28. -centered (done: embeded center tag...not sure if that passes standards)
  29. -occupy 90% of the width-space of the "backing" div (done: width=80% in style)
  30.  
  31. The trouble spot mainly comes in with:
  32. -ONLY overflow downwards and not side-side. I would effectively like the DIV tag to perform some sort of "wrap". I am ok with a scrollbar, but only if it scrolls up/down, not left/right. Even if there is no scrollbar and it grows unbounded downwards, I would be ok with it.
  33.  
  34. Does anyone have any thoughts on this?
  35. Currently, the style for that DIV is this:</p>
  36.     </div>
  37.     </div>
  38. </body>
  39. </html>

Reply
Plater's Avatar
Plater
Moderator
4,843 Posts
March 27th, 2008
05:04 PM
#3

Re: CSS and DIV, trouble overflowing "correctly"
Hmm that does produce the appearance of correctness in that situation.
However the outlying DIV contains a bit more pieces and already has it's own CSS. I suppose I should have though to include that. I wrote the CSS for it a long time ago however.
Code: ( text )
  1. #backing
  2. {
  3.    z-index: 100;
  4.    position: static;
  5.    display: block;
  6.    width: 760px;
  7.    background-color: #faebd8;
  8.    text-align:left;
  9. }


So when I tried to "combine" them I came up with this:
Code: ( text )
  1. #backing
  2. {
  3.    z-index: 100;
  4.    position: static;
  5.    display: block;
  6.    width: 760px;
  7.    background-color: #faebd8;
  8.    text-align:left;
  9. }
  10.  
  11. #PageAnnouncement
  12. {
  13.    margin:0 auto;
  14.    padding:2px;
  15.    border: 3px solid red;
  16.    border-collapse:collapse;
  17.    background-color:yellow;
  18.    font-size:14px;
  19.    width: 90%;
  20.    overflow: auto;
  21. }

Which didn't appear to change at all from my previous attempts.

Reply
drhowarddrfine's Avatar
drhowarddrfine
Expert
4,036 Posts
March 27th, 2008
05:46 PM
#4

Re: CSS and DIV, trouble overflowing "correctly"
Didn't notice I left 'overflow:auto' in there. I don't understand what its purpose is for you. I think I don't understand what you are looking for now.

Reply
Plater's Avatar
Plater
Moderator
4,843 Posts
March 27th, 2008
06:18 PM
#5

Re: CSS and DIV, trouble overflowing "correctly"
I am attaching two images, one in FF and one in IE.
These are with overflow not specified (nothing about overflow entered), but otherwise using the "combined" CSS from earlier.

FF correctly retains the box size, buit does not "wrap" the text and lets it go floating on to the side.
IE keeps the text inside the box, but increases the box's width.

I want the Box's 90% width to stay like in FF, but the text to cause it to grow down (and not to the side, if IE made it grow down instead of out, that would be what i want)

EDIT: the dimensions limit me from uploading (hold on)

http://www.rxms.com/images/webimage/FF.JPG
http://www.rxms.com/images/webimage/IE.JPG

Reply
Plater's Avatar
Plater
Moderator
4,843 Posts
March 27th, 2008
08:10 PM
#6

Re: CSS and DIV, trouble overflowing "correctly"
After stopping and looking at my pictures I think I realized my problem.
My test was bad, I am using a non-breaking stream of characters....

Reply
drhowarddrfine's Avatar
drhowarddrfine
Expert
4,036 Posts
March 27th, 2008
09:26 PM
#7

Re: CSS and DIV, trouble overflowing "correctly"
Yep. Non-breaking characters will cause that.

Reply
Plater's Avatar
Plater
Moderator
4,843 Posts
March 27th, 2008
09:32 PM
#8

Re: CSS and DIV, trouble overflowing "correctly"
Yeah, so after all that what I had to start with was correct.
Some days I should just never leave the manufacturing zone.

Reply
Reply
Not the answer you were looking for? Post your question . . .
173,562 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top HTML / CSS Forum Contributors