|
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
> 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
> 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?
In your CSS:
#stuffFromDatabase a {
...
}
In your HTML:
show/hide quoted text
<div id="stuffFromDatabase">
...
show/hide quoted text
</div>
show/hide quoted text
This will make any <a> inside that <div> block appear with the style
defined in the style sheet. This makes it much simpler as you don't
show/hide quoted text
need to add any class information to the <a> tags themselves.
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
<div class="stuffFromDatabase">
...
show/hide quoted text
</div>
....
show/hide quoted text
<div class="stuffFromDatabase">
...
show/hide quoted text
</div>
--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
|