Styling links

SEO General Forum to discuss other related SEO Techniques

Styling links

Postby Genny » Wed Jun 24, 2009 2:18 am

Hi

What’s the difference between using embedded inline styles in web page content (as opposed to embedded styles in the head section of the page), and using the span tag. CSS tutorials strongly advise against using embedded inline styles (highly frowned upon), and advise using external style sheets.

After much online searching on the use of the span tag I’ve noticed that it’s popularly used, but it seems to me it’s not much different to the frowned upon inline styles.

The reason for this query is that I’ve got sub heads formatted to h2 (for SEO purposes) & I want them to be colored black. Problem is that they also serve as links to other pages – I’ve styled a:link to be black to counter this but in the same div container there are other links within paragraphs – I want these to be the traditional blue link colour – but of course, they’re now black too.

Any ideas how I can style linked sub heads to be black whilst paragraph text links to be blue – they’re all in the same div container? Can I merely enclose the sub heads in a span tag with only an ID and then have a style for it in the external style sheet?

Would appreciate some help
Genny
Genny
Just getting Started
Just getting Started
 
Posts: 12
Joined: Wed Feb 11, 2009 12:06 am

Re: Styling links

Postby Loz » Wed Jun 24, 2009 5:22 am

what's the site in question. i'll take a look
User avatar
Loz
Site Admin
Site Admin
 
Posts: 1346
Joined: Wed Jun 20, 2007 6:28 am
Location: England

Re: Styling links

Postby Genny » Wed Jun 24, 2009 3:57 pm

Hi Loz

The site is not uploaded yet - thanks. But I think I've figured it out anyway. I use Dreamweaver and it seems that if I create a class style and then apply it to a section of inline text, Dreamweaver automatically puts in the span tags - so it assigns a class style that's in an external style sheet, to the text. With the sub heads I've already tried applying a class style (to color the font black) - didn't work. Since there will always be a limited number of sub heads on each page I'm going to try simply highlighting the sub heads & put them in their own divs - & then assign a class style to it. This should work.

Regards
Genny
Genny
Just getting Started
Just getting Started
 
Posts: 12
Joined: Wed Feb 11, 2009 12:06 am

Re: Styling links

Postby Loz » Thu Jun 25, 2009 5:22 am

you dont need to use span or div tags to style links you can use the pasudo code to apply a class to the link, or a H1 tag or what ever
User avatar
Loz
Site Admin
Site Admin
 
Posts: 1346
Joined: Wed Jun 20, 2007 6:28 am
Location: England

Re: Styling links

Postby Genny » Thu Jun 25, 2009 4:07 pm

Loz wrote:you dont need to use span or div tags to style links you can use the pasudo code to apply a class to the link, or a H1 tag or what ever


Hi Loz

I've already got pseudo styles for links in place - different ones for different sections (main content, navigation bar, sidebar & footer). I wanted links in the main content paragraph text to be blue so that visitors could see that they are clickable links, but if the 4 main subheads are also bright blue - it's too hard on the eyes. Tried creating a class style and applying to the subheads using span tags and then also tried it with divs - didn't work. Realized that you can't have a class style AND have it affect the color of links too (at least I don't think you can in XHTML) - has to be a pseudo style so that rules out class styles. In the end I created 4 a:link styles in the external style sheet (header1, header2, etc), and put each of the h2 headers into their own divs - with those IDs - works great. The maximum subheads I'll ever have per page is 4 so those 4 styles should suffice.

Thanks again
Genny
Genny
Just getting Started
Just getting Started
 
Posts: 12
Joined: Wed Feb 11, 2009 12:06 am

Re: Styling links

Postby Loz » Thu Jun 25, 2009 4:57 pm

send me a PM and I will give you my email address so you can send me the files, I'll help ya out :) and do a video for you to explain what it is I am doing :)
User avatar
Loz
Site Admin
Site Admin
 
Posts: 1346
Joined: Wed Jun 20, 2007 6:28 am
Location: England


Return to SEO General

Who is online

Users browsing this forum: No registered users and 0 guests

cron