Click here to get back home

multiple link styles without classes?

 HomeNewsGroups | Search

comp.infosystems.www.authoring.html - discuss HTML authoring here 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
multiple link styles without classes? news 05-20-2005
Posted by news on May 20, 2005, 3:21 pm
Please log in for more thread options


I have a site that pulls half its content from a database. Text that
will have links in it, that I won't be able to alter. They'll all be
like
show/hide quoted text
But I want to give links within this database pulled text to have a
different style than the rest of the page.

Here's a couple of ways I can think of to do it, but I'd like to know
if there's a better way.

Set up a style for the generic link which will affect those pulled from
the database, and then in all the static links on the page, use a
separate class.
Use PHP to replace
<a href...
with
<a class="blah" href...

Is there some other way that would be better?

Thanks for any tips!
Liam


Posted by Chris Hope on May 21, 2005, 10:26 am
Please log in for more thread options


news@celticbear.com wrote:

show/hide quoted text

In your CSS:

#stuffFromDatabase a {
...
}

In your HTML:

show/hide quoted text
...
show/hide quoted text

show/hide quoted text
defined in the style sheet. This makes it much simpler as you don't
show/hide quoted text

If you need to make it appear in several areas of the page instead of
just one block then you could make them use a class instead of an id
like this:

..stuffFromDatabase a {
...
}

show/hide quoted text
...
show/hide quoted text

....

show/hide quoted text
...
show/hide quoted text


--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com


Posted by Andy Dingley on May 21, 2005, 1:12 pm
Please log in for more thread options


On Sat, 21 May 2005 09:26:58 +1200, Chris Hope

show/hide quoted text

That's the neat way to do it, although personally I'd make one change.
Rather than an id "stuffFromDatabase" I'd make that a class (so it's
..stuffFromDatabase a { } in the CSS too).

The reasons are twofold:

- We don't know that there couldn't be more than one
show/hide quoted text
to rule this out, we shouldn't rule it out.

- I don't like applying CSS to large blocks of HTML via id rather than
class. Id has a high priority in CSS and so it tends to have "sticky"
effects. This is OK on a small area, but it can be awkward if you want
to apply another link style within that area, by using another class.



Posted by news on May 23, 2005, 9:18 am
Please log in for more thread options


Andy Dingley wrote:
show/hide quoted text
change.
show/hide quoted text
it's
show/hide quoted text


Great! Thanks for the suggestions and replies!
Liam


Similar ThreadsPosted
Apply multiple css styles to a textfield? April 25, 2005, 5:05 pm
EAD and E-text classes at Rare Book School 2005 January 26, 2005, 9:53 am
multiple instances of a CSS link due to server-side file inclusion and tools requirements November 18, 2008, 12:03 am
Help with styles and hot links April 4, 2006, 11:36 am
style to remove all styles March 25, 2005, 5:09 am
text box styles in a mac enviroment May 18, 2005, 9:32 am
width and height styles on tag June 29, 2005, 3:37 pm
CSS styles not working for anchor tags. August 13, 2005, 4:03 pm
Persistent, default and alternate styles December 21, 2005, 11:40 am
DHTML/js set text content w/ styles January 30, 2006, 5:19 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy