473,382 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

div at top not expanding with content

Hi All,

Working on a new design for our site trying to incorporate fluid design,
etc.

Ran into a situation that is befuddling me.

In this instance <http://ocgweb.marine.usf.edu/~patrick/New/testwidth.html>

The top banner divs expand when the browser is resized, but when the
scroll bar is moved when the browser window is smaller the top doesn't
expand. We do have contour plot images that may be 900px or more wide
and it just doesn't look right when top doesn't move with the scroll
bars. Any idea how to fix this? I have tried a number of ways but am at
the point of needing help from those more experienced than myself.

Thanks,
Patrick

--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group – USF - College of Marine Science
http://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld
Mar 6 '07 #1
6 7672
Patrick Smith wrote:
In this instance <http://ocgweb.marine.usf.edu/~patrick/New/testwidth.html>

The top banner divs expand when the browser is resized, but when the
scroll bar is moved when the browser window is smaller the top doesn't
expand.
Try wrapping it all up in a container div.

You've got your div#topwrap set to width:100%, and that's what you get;
no matter how you resize the window, your top header changes to be 100%
of the viewport's width (even if it's partially off the screen to the
left). You get what you asked for.

What you *want* is that div#topwrap is 100% of the *content's width*,
even when it overflows the viewport. The browser provides a scrollbar
when the images and menu are wider than the viewport's current size, but
div#topwrap doesn't know how big it's supposed to be, because it's an
unrelated sibling to div#contentwrap (and #menubar and #footer). It
seems as though body (the parent apparent) would handle this for us, but
it doesn't. We need a div (or other parent element) for div#topwrap to
be 100% of, which also knows how wide to be for #contentwrap.

If you are lucky, Jukka or Ben C or somebody will come in here with a
better (i.e., more technically accurate) explanation. If I am lucky, I
will even understand their explanation when they provide it.

HTH
--
John
Mar 6 '07 #2
On 2007-03-06, John Hosking <Jo**@DELETE.Hosking.name.INVALIDwrote:
Patrick Smith wrote:
>In this instance <http://ocgweb.marine.usf.edu/~patrick/New/testwidth.html>

The top banner divs expand when the browser is resized, but when the
scroll bar is moved when the browser window is smaller the top doesn't
expand.

Try wrapping it all up in a container div.
Unfortunately not just any container div. You need one with a
shrink-to-fit auto width.
You've got your div#topwrap set to width:100%, and that's what you get;
no matter how you resize the window, your top header changes to be 100%
of the viewport's width (even if it's partially off the screen to the
left). You get what you asked for.

What you *want* is that div#topwrap is 100% of the *content's width*,
even when it overflows the viewport.
Yes, and this is the problem. Usually an element's auto width is a
function of containing width-- i.e. the space made available to it by
its parent, or by the viewport if it has no parent.

In other words, the browser works out the width of an element before it
even looks at its descendents (and its height generally after formatting
its descendents).

But for an element whose auto width is "shrink to fit" (floats, table
cells and inline blocks), the browser does use the contents to determine
the width of the element.

So the first thing is to add body { display: table-cell; }, or body {
float: left; }. Either should work. This should make the body at least
as wide as the content minwidth of its descendents, regardless of how
narrow the viewport is.

At this point the body is auto-width, and percentages of an auto-width
container are no good. They ought to be ignored, but YMMV. So compromise
and make #contentleft width: 14em (say) instead of width: 25%. Remove
float: right from #contentright and give it margin-left: 14em instead. We
need #contentright to have an auto-width because it's an ancestor of the
huge image.

If you really want #contentleft to be 25% of the viewport, rather than
of the body, you could make it absolutely positioned.
Mar 6 '07 #3
Patrick Smith <ps****@marine.usf.eduwrote:
>In this instance <http://ocgweb.marine.usf.edu/~patrick/New/testwidth.html>

The top banner divs expand when the browser is resized, but when the
scroll bar is moved when the browser window is smaller the top doesn't
expand. We do have contour plot images that may be 900px or more wide
and it just doesn't look right when top doesn't move with the scroll
bars.
The behaviour you are seeing is a good thing. There is no point in
pushing other content outside of the viewport just because one image
doesn't fit. A user may well only casually browse such pages and not
scroll to see the full image.

But you have more important issues to solve. The document contains not a
single header, the non decorative images have no alt content, and images
that contain text that is to small to be readable even on a low
resolution 85DPI screen.

--
Spartanicus
Mar 6 '07 #4
I'm totally out of my league here, and to be honest I don't understand
what it is you're trying to do, but what works for me is to set the
body width to 100% and to not designate a width for anything else. I
don't know if that's what you want, but what it does for me is that
images too big for the viewport get resized to fit, so that there is
no scrollbar at all. That's the effect I want.

In my case I had a 900 px image that was too large to fit on my
screen, and scroll bars appeared just to accommodate that image.
Everything else fit in under 780px. The above resized it to fit my
screen so that everything worked out nicely. No matter how much
resizing of my browser I do, all of my contents resize to fit so that
there are no scrollbars.

Now, from what I understand, I don't think a body width is supported
by the standards, so the proper way to do it may be to wrap everything
inside of a <divand set the width there. Like I say, I'm out of my
league but it may work. If I understand John Hosking's post
correctly, he's essentially saying the same thing, but since I'm not
sure I understand him, I thought I'd tell you what seems to work for
me. The other posts just kind of made my head spin so, if what
they've got to say works for you, great! What the heck is an
"unrelated sibling" anyway? I guess I could ask my unrelated
brother. :)
On Mar 6, 7:42 am, Patrick Smith <psm...@marine.usf.eduwrote:
Hi All,

Working on a new design for our site trying to incorporate fluid design,
etc.

Ran into a situation that is befuddling me.

In this instance <http://ocgweb.marine.usf.edu/~patrick/New/testwidth.html>

The top banner divs expand when the browser is resized, but when the
scroll bar is moved when the browser window is smaller the top doesn't
expand. We do have contour plot images that may be 900px or more wide
and it just doesn't look right when top doesn't move with the scroll
bars. Any idea how to fix this? I have tried a number of ways but am at
the point of needing help from those more experienced than myself.

Thanks,
Patrick

--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group - USF - College of Marine Sciencehttp://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld

Mar 8 '07 #5
Dudely wrote:
Now, from what I understand, I don't think a body width is supported
by the standards, so the proper way to do it may be to wrap everything
inside of a <divand set the width there. Like I say, I'm out of my
league but it may work. If I understand John Hosking's post
correctly, he's essentially saying the same thing, but since I'm not
sure I understand him, I thought I'd tell you what seems to work for
me. The other posts just kind of made my head spin so, if what
they've got to say works for you, great! What the heck is an
"unrelated sibling" anyway? I guess I could ask my unrelated
brother. :)
Well, there you go reading for comprehension again, when it's clear I
was writing for speed! You should know better.

I can clarify what I meant, because I've just consulted with my sister
(no relation). :-)

I stand by the "sibling" part, because that's what the elements were:
siblings of each other.

I think when I wrote "unrelated", I meant (a) non-descendent (duh,
they're *siblings*!) and also (b) that they had no effect on each
other's width through some positioning juxtaposition (i.e., they weren't
next to each other fighting over browser width they had to share). (And
I apologize already for having posted "positioning juxtaposition" to usenet.

That's my story and I'm sticking with it.
Oh, and: In future, please don't top-post Type your contributions
following the points you want to reply to, and trim the rest. You
included the whole text below, and didn't trim anything (although I've
left some and trimmed some just for illustration purposes).
On Mar 6, 7:42 am, Patrick Smith <psm...@marine.usf.eduwrote:
Also, I understand GoogleGroups doesn't do this automatically (like many
newsreaders do), but it'd be great if you'd trim sigs, too. Everything
below is unnecessary for your reply.
>>Thanks,
Patrick

--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group - USF - College of Marine Sciencehttp://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld
Including this! Cheers,
--
John
Mar 9 '07 #6
On 2007-03-08, Dudely <ab****@gmail.comwrote:
I'm totally out of my league here, and to be honest I don't understand
what it is you're trying to do, but what works for me is to set the
body width to 100% and to not designate a width for anything else. I
don't know if that's what you want, but what it does for me is that
images too big for the viewport get resized to fit, so that there is
no scrollbar at all. That's the effect I want.
That's very odd behaviour. What should happen in that case is that the
image overflows body and you get a horizontal scrollbar. What browser
were you using?
In my case I had a 900 px image that was too large to fit on my
screen, and scroll bars appeared just to accommodate that image.
Everything else fit in under 780px. The above resized it to fit my
screen so that everything worked out nicely. No matter how much
resizing of my browser I do, all of my contents resize to fit so that
there are no scrollbars.

Now, from what I understand, I don't think a body width is supported
by the standards, so the proper way to do it may be to wrap everything
inside of a <divand set the width there.
Even that should make no difference-- you should get the image
overflowing the container, not resizing to fit into it.
Mar 9 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: infinull | last post by:
I am making a script that is a very complex Content Management system. it makes a UDM navigation bar and writes content and a title. i want it to write content other that just basic text, like a...
1
by: Bhiksha Raj | last post by:
Hi, I created an expanding menu on one of the frames in my webpage using code I got from http://www.dynamicdrive.com/dynamicindex1/navigate1.htm I have embedded the code (with minor...
1
by: interfaced | last post by:
Is there a way to make an autosized textbox relative to the content, here is my attempt: <script type="text/javascript"> function checkHeight(el){ var...
1
by: justingoodman | last post by:
I'm working on a website for a friend, and the layout has been giving me some trouble. http://members.osc3.com/nosferatu/zombie/ I would like the content panels to be able to be any length,...
1
by: fatjoez | last post by:
Hey there. I've been trying to modify my file upload script so that it handles 10 files instead of one. i was thinking the most straightforward way would be to add a FOR LOOP? placed...
4
bakum
by: bakum | last post by:
Hi, i've got a basic layout as follows: One large table (height 100%) with two columns, left and right. Inside the left column are two divs#bottom #top. Inside the right column is one div#main. ...
1
by: Miked | last post by:
Hello: I'm relatively new to CSS, and I'm doing a site where I don't want to use any tables. I've gotten pretty far, and the site has the layout I want. My only problem is that I'm using the...
2
by: Sepharoth | last post by:
Hello. I am currently making a PHP online game called Xantium Academy. It can be found at http://xantium.co.nr and you click on the image to log in. Anyway, i dont know much about CSS and...
1
by: cbradio | last post by:
thescripts gurus, I would like to know if I could get some help with making elements of my layout expand (liquid) to the size of their containers, but also allow for some predefined, static...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.