[ 7 posts ]

D Collins

  • Username: DaveC426913
  • Joined: Mon Dec 12, 2011 12:27 pm
  • Posts: 21
  • Offline
  • Profile

100% div height in Firefox - still no solution?

Post Posted: Tue Jan 24, 2012 10:18 am
+0-
I've tried dozens of solutions out there in the web and none of them work.

I want to put a YUI datatable on the left side of my page so that it fills the browser's full height, and then, if the datatable content is too big, it will scroll vertically.

I should be able to do this by setting the html/body elements to 100% and then populating it with divs of height 100%. I've tried so many solutions, they're all *years* old - and not one of them work.

I'm currently running FF9.

Anyone?

And what if I want to just scroll my datatable? I've got datatable-datasource but there's no datatable-datasource-scroll.

Surely I'm not the first YUI developer who wants a datatable that fills the browser height?

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: 100% div height in Firefox - still no solution?

Post Posted: Wed Jan 25, 2012 4:48 am
+0-
Does this work for you? http://jsfiddle.net/8LCQB/

I think most of us use JavaScript to avoid the 100% height problem when doing complex app-like layouts. There's a nice module in YUI for throttling the resize event called event-resize that's helpful for that.

D Collins

  • Username: DaveC426913
  • Joined: Mon Dec 12, 2011 12:27 pm
  • Posts: 21
  • Offline
  • Profile
Tags:

Re: 100% div height in Firefox - still no solution?

Post Posted: Wed Jan 25, 2012 6:49 am
+0-
Well, it makes the div fill the screen with no scroll, yes. So, the idea then is to place everything on the screen using absolute positioning? Or at least absolute dimensions?

But that doesn't solve the problem of changing browser size. I tried placing a div within the main div and setting its height to 100% (so that it fills the window regardless of size), but I end up with an inner div that overhangs the outer div and triggers the scroll bars.

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: 100% div height in Firefox - still no solution?

Post Posted: Wed Jan 25, 2012 7:04 am
+0-
DaveC426913 wrote:
Well, it makes the div fill the screen with no scroll, yes. So, the idea then is to place everything on the screen using absolute positioning? Or at least absolute dimensions?

No, not at all. The idea is to put everything inside the 100% height div and try not to break it.

DaveC426913 wrote:
But that doesn't solve the problem of changing browser size. I tried placing a div within the main div and setting its height to 100% (so that it fills the window regardless of size), but I end up with an inner div that overhangs the outer div and triggers the scroll bars.

I don't quite follow what your problem is. It sounds as if there's other content that is overflowing the container. Without a jsfiddle or a live example it'll be hard to figure out what's wrong.

As far as scrolling datatables go, Luke's working on Y.DataTable.Scrollable for 3.5.0. You can check it out in the preview he uploaded to the Gallery http://yuilibrary.com/gallery/show/data ... 50-preview

Alberto Santini

YUI Contributor

  • Offline
  • Profile

Re: 100% div height in Firefox - still no solution?

Post Posted: Wed Jan 25, 2012 7:18 am
+0-
Hello D.

About datatable, datasource and scroll you may read "Plugin.DataTableSort problem Datatable using Datasource.IO" post:
viewtopic.php?f=92&t=7180

Hope that helps,
IceBox

D Collins

  • Username: DaveC426913
  • Joined: Mon Dec 12, 2011 12:27 pm
  • Posts: 21
  • Offline
  • Profile

Re: 100% div height in Firefox - still no solution?

Post Posted: Wed Jan 25, 2012 7:29 am
+0-
"I don't quite follow what your problem is. It sounds as if there's other content that is overflowing the container. Without a jsfiddle or a live example it'll be hard to figure out what's wrong."

If I set my wrapper to 100%, it fills the window (say my window is 760px, now my wrapper is 760px). Perfect.

I add a header bar of 40px.
Below that I want a content area that fills the space vertically. How do I tell the content div to be only 720px in height without hardcoding its height? (The solution needs to work if I resize the browser, I can't hardcode its height).

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: 100% div height in Firefox - still no solution?

Post Posted: Wed Jan 25, 2012 7:35 am
+0-
DaveC426913 wrote:
I add a header bar of 40px.
Below that I want a content area that fills the space vertically. How do I tell the content div to be only 720px in height without hardcoding its height? (The solution needs to work if I resize the browser, I can't hardcode its height).

Oh ok! Yeah, there's no way of doing that with CSS in older browsers. Most of the time we try to mimic it with background colors. Modern browsers have more tools for complex layouts like that and in the future they'll possibly support stuff like height: 100% - 40px. So yes, in your place I'd probably avoid the problem and use JavaScript to set the height of that flexible div.

You can also try out this Gallery module http://yuilibrary.com/gallery/show/axo-layout
  [ 7 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron