473,387 Members | 1,664 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,387 software developers and data experts.

Collapsed text using CSS

I have tried to collapse a long part of a text on my weblog
using the following construct:

<style>
div.expand { display : none; }
div.expand:hover (display : inline; }
div.expand em {display : inline; }
</style>

<p>Blablabla etc lorem ipsum yadayada</p>
<div class='expand'>
<em>expand!</em>
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
[...]
</div>

Using the <emtags I hoped to make only the expand! text visible by
default. But it isn't. Everything inside the <divis hidden (I use FF
1.5.0.8 on Linux) myself. Besides, this won't work on IE6, not sure
about 7. But since I don't care much for IE compatibility, I can live
with that (or provide an alternative using a hack).

How should I have approached this, if at all possible using CSS?
Ideally, is there a one-size-fits-all (browsers) solution, other than
JavaScript?

TIA!
Sh.
Dec 18 '06 #1
11 7423
Schraalhans Keukenmeester <bi*******@invalid.spamwrote:
div.expand { display : none; }
div.expand:hover (display : inline; }
div.expand em {display : inline; }
And how do you propose that keyboard users should access the content, or
users of speaking browsers?

--
Spartanicus
Dec 18 '06 #2
Spartanicus wrote:
Schraalhans Keukenmeester <bi*******@invalid.spamwrote:
> div.expand { display : none; }
div.expand:hover (display : inline; }
div.expand em {display : inline; }

And how do you propose that keyboard users should access the content, or
users of speaking browsers?
No idea. How does 'the average' newssite go about that? Loads of those
show only an excerpt of the full item and offer either a link or a
collapsed fragment.

Come to think of it, a separate style sheet for the visually impaired
would by no means diminish the usability of such a collapse/expand script.

If keyb users are the issue (to be honest, I don't worry too much about
all three of them) the focus pseudoclass would achieve the same wouldn't it?

Do you have a suggestion for a working solution too, Spartanicus?
Sh.
Dec 19 '06 #3
Schraalhans Keukenmeester wrote:
>And how do you propose that keyboard users should access the content, or
users of speaking browsers?
No idea. How does 'the average' newssite go about that? Loads of those
show only an excerpt of the full item and offer either a link or a
collapsed fragment.
By using keyboard triggerable events on focusable elements (links work very
well).
If keyb users are the issue (to be honest, I don't worry too much about
all three of them)
There are a great many keyboard users. Giving up use of a mouse can do
wonders for RSI (as I discovered a few summers ago) (and there are plenty
of other reasons to not use a pointing device).
the focus pseudoclass would achieve the same wouldn't
it?
No, since you can't give the focus to a div.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Dec 19 '06 #4
Rik
David Dorward wrote:
Schraalhans Keukenmeester wrote:
>>And how do you propose that keyboard users should access the
content, or users of speaking browsers?
>No idea. How does 'the average' newssite go about that? Loads of
those show only an excerpt of the full item and offer either a link
or a collapsed fragment.

By using keyboard triggerable events on focusable elements (links
work very well).
And a link is somewhat more logical then <em>.....
>If keyb users are the issue (to be honest, I don't worry too much
about all three of them)

There are a great many keyboard users. Giving up use of a mouse can do
wonders for RSI (as I discovered a few summers ago) (and there are
plenty of other reasons to not use a pointing device).
Like being about ten times as fast for instance. Allthough that might
depend on some highly exotic markup sometimes used, when tabbing let's
focus shoot across the page without a clear pattern. No need to think only
the handicaped or RSI-casualties don't use a pointing device.
>the focus pseudoclass would achieve the same wouldn't
it?

No, since you can't give the focus to a div.
Indeed.
--
Rik Wasmus
Dec 19 '06 #5
In article <em*******************@news.demon.co.uk>,
David Dorward <do*****@yahoo.comwrote:
Giving up use of a mouse can do
wonders for RSI
Very true, is it so easy to do completely though? I try to use
keyboard commands wherever I can but perhaps better look into
more sophisticated ,ethods...

--
dorayme
Dec 19 '06 #6
Schraalhans Keukenmeester wrote:
Spartanicus wrote:
>Schraalhans Keukenmeester <bi*******@invalid.spamwrote:
>> div.expand { display : none; }
div.expand:hover (display : inline; }
div.expand em {display : inline; }
And how do you propose that keyboard users should access the content, or
users of speaking browsers?

Do you have a suggestion for a working solution too, Spartanicus?
Sh.
And does anyone of the honourable gentlemen/ladies have a suggested
solution? Or has this now merely become a pamflet for programming with
the disabled in mind?

Thanks
Dec 19 '06 #7
Schraalhans Keukenmeester <bi*******@invalid.spamwrote:
>Do you have a suggestion for a working solution too, Spartanicus?
Before solutions can be discussed you'd have to show us the problem (the
bit of bogus data in your OP doesn't demonstrate anything).

--
Spartanicus
Dec 19 '06 #8
Scripsit Schraalhans Keukenmeester:
And does anyone of the honourable gentlemen/ladies have a suggested
solution? Or has this now merely become a pamflet for programming with
the disabled in mind?
A solution was (somewhat implicitly) suggested to you. Basically, you should
use links, not tricks, to put less important content "behind the (current)
scenes". You seem to have decided to ignore the advice.

If you wish to know how to make content inaccessible to many people using
CSS, I suggest that you use a paid consultant who won't object to your
goals.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 19 '06 #9
Schraalhans Keukenmeester wrote :
Schraalhans Keukenmeester wrote:
>Spartanicus wrote:
>>Schraalhans Keukenmeester <bi*******@invalid.spamwrote:

div.expand { display : none; }
div.expand:hover (display : inline; }
div.expand em {display : inline; }
And how do you propose that keyboard users should access the content, or
users of speaking browsers?
Do you have a suggestion for a working solution too, Spartanicus?
Sh.

And does anyone of the honourable gentlemen/ladies have a suggested
solution? Or has this now merely become a pamflet for programming with
the disabled in mind?

Thanks
I use a cordless mouse which rely on batteries. Sometimes, the batteries
no longer work and then I very easily/quickly notice how bad some
websites are created. Just use links, plain links, normal links.

Gérard
--
remove blah to email me
Dec 19 '06 #10
And does anyone of the honourable gentlemen/ladies have a suggested
solution? Or has this now merely become a pamflet for programming with
the disabled in mind?
Something like:
----------
<style>
div.expand {height: 1.4em; overflow: hidden;}
div.expand:hover {height: auto;}
</style>

<p>Blablabla etc lorem ipsum yadayada</p>
<div class='expand'>
<em>expand!</em><br>
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
[...]
</div>
----------
... maybe? Not exactly a textbook answer but, depending on it's purpose, it
or some variant might work. Seems to work in IE7 with XHTML Transitional
(not default though) - don't know about IE6.

I'd probably lean towards Javascript though. The JQuery library is pretty
handy for this stuff.


Dec 19 '06 #11
On 2006-12-18, Schraalhans Keukenmeester <bi*******@invalid.spamwrote:
I have tried to collapse a long part of a text on my weblog
using the following construct:

<style>
div.expand { display : none; }
div.expand:hover (display : inline; }
You mean { of course. But that's not the only problem.
div.expand em {display : inline; }
</style>

<p>Blablabla etc lorem ipsum yadayada</p>
<div class='expand'>
<em>expand!</em>
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
[...]
</div>
It doesn't work because a block with display: none is like a black hole
from which nothing, not even boxes with display: inline, can escape.

So your display:inline em inside the display:none div is not visible.

How about this:

<style type="text/css">
div.expand span.collapsible { display : none; }
div.expand:hover span.collapsible { display : inline; }
</style>
</head>

...

<p>Blablabla etc lorem ipsum yadayada</p>
<div class='expand'>
<em>expand!</em>
<span class="collapsible">
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
long list of collapsed text
[...]
</span>
</div>
Dec 20 '06 #12

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

Similar topics

2
by: Haines Brown | last post by:
This may seem a pointless question, but I'm trying work around an inconsistency between browsers. I have a template that contains a division that holds a text that sometimes exists and sometimes...
3
by: jbailo | last post by:
Some say that with higher productivity, the American worker has too much time on his hands. True, just witness this innovative 'erotica' site: http://www.snotgirls.com/preview1.html For...
0
by: Jesse Liberty | last post by:
Is it possible to feed an XML document to an Iframe, but have the contained elements start out collapsed (so that you must click on them to open them) rather than having the entire document open...
4
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
0
by: Hal | last post by:
How do you change the Background Color for a (collapsed) Date Time Picker control from the default white? (I can change every other color setting on this control like its background color when...
2
by: kevin | last post by:
I would like to remember the state of the nodes after the treeview gets disposed, but not necessarily after the app terminates so I don't need a disk file. I was thinking about using the tag...
2
by: Rick | last post by:
Let me start by saying that I know very little about JavaScript. The software that I use to convert my FrameMaker files to HTML uses a JavaScript to hide certain text. The user has to click the...
0
by: Salim | last post by:
Hi, There is a problem with CollapsiblePanelExtender CollapsiblePanelExtender1.Collapsed property always returns false even when I collapse or expend. Thanks in advance.
1
by: Hvid Hat | last post by:
I'm using <xsl:copy-of select="content" /on the following XML: <?xml version="1.0"?> <content> <p></p> <p>This is a paragraph</p> <p></p> <p>This is another paragraph</p> </content>
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.