Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-02-21 02:07:42
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Is there an easier way to do this?
I confess that I probably reinvented the wheel but I just finished massaging a list of menu items so that it displays as a normal vertical block when CSS is available and as a horizontal inline menu without CSS. The reverse of normal but it was to solve a specific problem.
I used the following approach:
in the CSS
.blocked {display: block;}
.hidden { display: none;}
in the HTML
<code>
<span class=“blocked”><a href=”#”>Item 1</a></span>
<span class=“blocked”><a href=”#”>Item 2</a></span>
<span class=“blocked”><a href=”#”>Item 3</a></span>
</code>
<br />
This displays with CSS as
Item 1
Item 2
Item 3
and without CSS as
Item 1 Item 2 Item 3
I have a rather bad head cold and things are a bit fuzzy at the moment and I’m probably overlooking something obvious so . . . is there a better/easier way to do this?
Last edited by NyteOwl (2006-02-21 02:10:33)
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
Re: Is there an easier way to do this?
You could do something like this too. Doesn’t require a classed span
around the links.
<code>
<div id=“somewrapper”>
<a href=”#”>Item 1</a>
<a href=”#”>Item 2</a>
<a href=”#”>Item 3</a>
</div>
</code>
<pre>
#somewrapper a:link {
display:block;
}
</pre>
Shoving is the answer – pusher robot
Offline
Re: Is there an easier way to do this?
Why aren’t you using unordered(UL) lists?
Offline
Re: Is there an easier way to do this?
He wants the vertical list style only when CSS is available, otherwise it should be horizontal. Using a UL would give you the opposite effect.
Shoving is the answer – pusher robot
Offline
#5 2006-02-21 22:13:54
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: Is there an easier way to do this?
hakjoon: I feel like my head is tuffed with cotton or I would have just wrapped the whole menu :) Thanks!
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
Pages: 1