Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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>&nbsp;
<span class=“blocked”><a href=”#”>Item 2</a></span>&nbsp;
<span class=“blocked”><a href=”#”>Item 3</a></span>&nbsp;
</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

#2 2006-02-21 14:04:12

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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>&nbsp;
<a href=”#”>Item 2</a>&nbsp;
<a href=”#”>Item 3</a>&nbsp;
</div>
</code>

<pre>

#somewrapper a:link { display:block;
}
</pre>


Shoving is the answer – pusher robot

Offline

#3 2006-02-21 15:40:27

TheEric
Plugin Author
From: Colorado & Montana.
Registered: 2004-09-17
Posts: 592
Website

Re: Is there an easier way to do this?

Why aren’t you using unordered(UL) lists?

Offline

#4 2006-02-21 15:44:47

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

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

Board footer

Powered by FluxBB