HighDots Forums  

using display or visibility to implement tabs

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss using display or visibility to implement tabs in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Summercool
 
Posts: n/a

Default using display or visibility to implement tabs - 10-26-2007 , 03:41 AM







it seems that we can actually use "display" or "visibility" to
implement tabs. i just wonder if there are pros and cons?

it seems that if we use "display", the browser may need to shrink the
1st tab first, and then redisplay the second and re-flow the things on
the screen, thus causing a time delay.

with visibility, there probably is not such delay...

so is this how you make the big tabs content div's:

<div id="tab1" style="height: 800px">
content 1
</div>

<div id="tab2" style="positive: relative; top: -800px">
content 2
</div>

tab3, tab4 the same way as tab2...

and then just use javascript to toggle the visibility.

thanks.


Reply With Quote
  #2  
Old   
Ben C
 
Posts: n/a

Default Re: using display or visibility to implement tabs - 10-26-2007 , 03:47 AM






On 2007-10-26, Summercool <Summercoolness (AT) gmail (DOT) com> wrote:
Quote:
it seems that we can actually use "display" or "visibility" to
implement tabs. i just wonder if there are pros and cons?

it seems that if we use "display", the browser may need to shrink the
1st tab first, and then redisplay the second and re-flow the things on
the screen, thus causing a time delay.
That sounds about right.

Quote:
with visibility, there probably is not such delay...
Exactly, a visibility change will never move anything on the screen so
the browser can avoid a reflow.

Quote:
so is this how you make the big tabs content div's:

div id="tab1" style="height: 800px"
content 1
/div

div id="tab2" style="positive: relative; top: -800px"
content 2
/div

tab3, tab4 the same way as tab2...

and then just use javascript to toggle the visibility.
Something broadly along those lines should be fine. Of course there's
no such property as positive: relative.


Reply With Quote
  #3  
Old   
rf
 
Posts: n/a

Default Re: using display or visibility to implement tabs - 10-26-2007 , 05:15 AM




"Summercool" <Summercoolness (AT) gmail (DOT) com> wrote

Quote:
it seems that we can actually use "display" or "visibility" to
implement tabs. i just wonder if there are pros and cons?
There certainly are.

Quote:
it seems that if we use "display", the browser may need to shrink the
1st tab first, and then redisplay the second and re-flow the things on
the screen, thus causing a time delay.
How much delay. A few milliseconds? In my experience (gained from picking up
my browser border and resizing it) my browsers can re-layout a page in about
20 milliseconds.

Quote:
with visibility, there probably is not such delay...
How much. Slightly less than a few milliseconds?

Quote:
so is this how you make the big tabs content div's:

div id="tab1" style="height: 800px"
You cannot gaurantee at all that the content of that div will be exactly 800
pixels high.

Quote:
content 1
/div

div id="tab2" style="positive: relative; top: -800px"
content 2
/div
So all of your tabs, that is all of the content in each tab, is going to be
exactly 800 pixels high? What if I change my font size?

Quote:
tab3, tab4 the same way as tab2...

and then just use javascript to toggle the visibility.
Without javascript (10% or so of your viewers) we will get either a blank
viewport or one with every tab stacked one upon the other.

Why not just make the tabs links like everybody else does, causing a new
page to be retrieved from the server?

--
Richard.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.