Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with overflow and parent item stretching

Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#1: Sep 16 '08
I have run into a situation, where I am not clear what attribbutes I have set incorrectly.
I have the following snipit of html:
Expand|Select|Wrap|Line Numbers
  1. <div id="divFloatingSearch" >
  2.     <div id="divSearchTop">
  3.         Enter in a search parameter:
  4.         <input name="tbSearchBox" type="text" id="tbSearchBox" onblur="CheckForAutoFill();" />
  5.     </div>
  6.     <div id="divSearchStatus">
  7.         Waiting to search...
  8.     </div>
  9.     <hr  color="maroon"/>
  10.     <div id="divSearchResults" >               
  11.     </div>
  12. </div>
  13.  
And the related CSS is:
Expand|Select|Wrap|Line Numbers
  1. #divFloatingSearch
  2. {
  3.     position: absolute; 
  4.     left: 0.5%; 
  5.     top: 25%; 
  6.     height: 500px;
  7.     width: 200px; 
  8.     text-align: center;
  9.     background-color:#faebd7; 
  10.  
  11.     font-size: 10pt; 
  12.     border: 1px solid;
  13.  
  14. }
  15. #divSearchTop
  16. {
  17. }
  18. #divSearchStatus
  19. {
  20.     width: 98%;
  21.  
  22.     display: block;
  23.     background-color: #ffcc8c;
  24.     font-size: 8pt;
  25.     vertical-align: top;
  26.     text-align: center;
  27.     overflow: visible;
  28. }
  29. #divSearchResults
  30. {
  31.     background-color: #ffff99;
  32.     height: 450px;
  33.     width: 99%;
  34.     overflow: auto;
  35. }
  36.  
Now the behavior I want, is to be able to appendChildren to "divSearchResults" in a way that "divSearchResults" will gain the scrollbars to scroll up/down and "divFloatingSearch" will just stretch to remain a "border" type effect if you will. IE6 exibits this behavior, but FF2 does not resize "divFloatingSearch" to keep up with "divSearchResults".

I would be completely OK with scrapping the scrollbars entirely and just correctly stetching the elements in a downward fashion. Possibly in the way that posting a message here can stretch the light-blue back ground and light-brownish/gray backgrounds with the textarea size.
Does anyone know what attributes I have set inccorectly in the CSS?
Is there like a "minimum-height" type attribute?

Expert
 
Join Date: Aug 2008
Posts: 397
#2: Sep 17 '08

re: Problem with overflow and parent item stretching


Quote:
I am not clear what attributes I have set incorrectly.
I'm not sure either. Nor is it exactly clear to me what you hope to accomplish.

Min/max height [1] is supported, except in our good friends IE/6 and down. The good news (providing the user does not have js disabled) is that "IE expressions" or javascript can be used to simulate min/max in the lower IEs.

I put up a simple example [2]. Both blocks named .search have no height set. Both inner blocks named .result have a set min-height: 100px;. The behavior to put text in the top block could be programmed. Put enough text in that inside block .result and it will push to the Equator without breaking out the bottom of the outside containing block .search. In other words, the top block is always open-- program it and it will expand vertically. The bottom block is simply text added manually to show how it will expand if that text were programmed. I hope this makes sense...?

[1]
css2.1 specs-- min/max height
[2]
simple example
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,577
#3: Sep 18 '08

re: Problem with overflow and parent item stretching


I think we need to see some html to figure out what's going on.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#4: Sep 18 '08

re: Problem with overflow and parent item stretching


Quote:

Originally Posted by David Laakso

[2]
simple example

That example is roughly exactly what I wish to do. Currently, I have removed all height attributes and let the box stay "collapsed" if you will. Since I will have to continue to dev for IE6, I will have to investigate those other methods maybe.

My ultimate end result would be to incorporate what you have in your [2] example, but then have a maximum bound as well that will start to scroll(maybe? I don't like the look of any of it though).

As for what its doing, I have an order form with many fields. Off to the left is this search thing. the results of that search are set in individual <div>s and when clicked, fills the fields with the correct results.

The problem came about with that there could be a LARGE number of results, and I think it bad practice to let it just keep going downward, forcing the user to scroll the WHOLE page (and losing track of the fields that need to be filled in) to possibly find their result. I might just put a size for the box back in and tell it to overflow:auto

I will attempt to break this apart into an example webpage to be shown.
Expert
 
Join Date: Aug 2008
Posts: 397
#5: Sep 18 '08

re: Problem with overflow and parent item stretching


Quote:

Originally Posted by Plater

My ultimate end result would be to incorporate what you have in your [2] example, but then have a maximum bound as well that will start to scroll(maybe? I don't like the look of any of it though)...<trim>
I might just put a size for the box back in and tell it to overflow:auto

Whatever does it for you and yours. I know from nothing about matters of aesthetics, much less functionality, or usablity...
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#6: Sep 18 '08

re: Problem with overflow and parent item stretching


I think I have decided to let the parent have no height attribute and supplying a static height (px) value for the child div and set overflow auto to on.
It looks the same in IE6/FF2/chrome and I have warmed up to having the scroll bar there.
Thanks for all the help. I also have no concept of asethetics, so having to do it makes my brain hurt.
Expert
 
Join Date: Aug 2008
Posts: 397
#7: Sep 18 '08

re: Problem with overflow and parent item stretching


Least you make what little is left of my brain hurt, consider setting overflow-y: scroll; Unless you know, of course, your users are very agile and have good eye and hand motor-skills enabling them to read while controlling both an horizontal and vertical scroll bar in your 200px wide block? So much for aesthetics...
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#8: Sep 19 '08

re: Problem with overflow and parent item stretching


It doesn't seem to cause horizontal scrolling. (I would kill myself if I thought I made something that scrolls left/right)
Plus: overflow-y isn't supported in ie6 :-(
Expert
 
Join Date: Aug 2008
Posts: 397
#9: Sep 19 '08

re: Problem with overflow and parent item stretching


Quote:

Originally Posted by Plater

overflow-y isn't supported in ie6 :-(

Please reload this in IE/ 6.0: overflow-y:scroll; in IE/6.0
"Property overflow-y doesn't exist in CSS level 2.1 but exists in [css3] : scroll"
Apology for the confusing issues of overflow:auto ; / overflow:scroll; / overflow-y:scroll; The above link uses overflow-y:scroll; and works as intended in IE/6.0.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#10: Sep 19 '08

re: Problem with overflow and parent item stretching


I've got it working (or so it would seem?) with the regular overflow calls.
No scrolling to the right happens. I think because I specify a width (in px) and it won't go over that, just wraps downward.
ALTHOUGH, I could probably still be hit with problem of having a really long string of characters with no blank space in it. Makes all browsers crap when it happens if you don't do anything about it.
But since I control what comes out of the search, shouldn't ever be an issue.
Expert
 
Join Date: Aug 2008
Posts: 397
#11: Sep 19 '08

re: Problem with overflow and parent item stretching


OK. Whatever works for you, and the browsers you intend to support, is the name of the game...

Good luck and best wishes for your success.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,161
#12: Sep 19 '08

re: Problem with overflow and parent item stretching


Quote:

Originally Posted by David Laakso

OK. Whatever works for you, and the browsers you intend to support, is the name of the game...

Good luck and best wishes for your success.

Which browsers have I not addressed?
IE, FF and Google Chrome are functioning correctly and with no horizontal scroll bars?
Expert
 
Join Date: Aug 2008
Posts: 397
#13: Sep 19 '08

re: Problem with overflow and parent item stretching


Quote:

Originally Posted by Plater

Which browsers have I not addressed?
IE, FF and Google Chrome are functioning correctly and with no horizontal scroll bars?

Can't see it so can't test it or push the envelope by stress testing it in any browser.
Reply