Jump to content

Recommended Posts

Hello all,

 

Im an absolute beginner at all of this im afraid so I appologise in advance if my question is a little simple! Ive added a hyperlink to our esite which is working but it appears underlined. I had a look on the various forums and tried adding a style switch but it didnt work. Here is the line

 

<a href=http://www.technomed.co.uk target=_blank ><font color=black>Testing hyperlink</a>

Thanks for any help you can offer.

 

Joel

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/
Share on other sites

No, that's a very bad approach. What if you want all links to appear this way? What you need to do is link a stylesheet:

<link href="path/to/screen.css" media="screen" type="text/css" rel="stylesheet" />

And in screen.css, add:

a {
    text-decoration: none;
}

Also, quote your attributes as in my first example, and get rid of the font tag. Instead, ask yourself, "why does this need to be black?" Let's say that it needs to be black because you hate the site and think it's smelly. In that case, change your link to:

<a href="whateverurl" class="smelly">link text</a>
<!-- People know how to open new windows. Only do it for them if you must -->

Then, you'd add this to your screen.css file:

a.smelly {
    color: black;
}

And you could make any smelly links appear in that color. Or, if you want all links to be black, move that "color: black;" line to the other rule ("a {") right below the text-decoration rule.

 

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659246
Share on other sites

It's not a bad approach, if he said he wanted all his links to be the same style then we could of shown him how to, and your way is a 'bad' approach, why make an external style sheet, when you can just use internal CSS ? (as it is only doing his links, on one page as far as we know)

 

Please don't jump to conclusions

 

 

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659247
Share on other sites

Allow me to approach this from a practical point of view: Nobody makes something some way for a completely arbitrary reason. There is always a purpose when it comes to websites. If you're just coloring links for fun, your users will be confused. But if there's some semantic reason, you want to build that in a maintainable manner.

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659251
Share on other sites

Again you make an assumption, do not say no-body colors links for fun, how do you know that? How do you know he isn't making a site with lots of different color links?

Please do not tell people they are doing it badly because they are not being your way.

It's his/her website, they can do it how they want.

 

If this is solved, please press solved at the bottom of the screen.

 

Thanks,

Blade

(p.s. can a mod lock this, it is going off topic)

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659257
Share on other sites

I thought it's an interesting discussion on CSS and web usability, but that's just me. In any case, let me get a word in: Links shouldn't be colored at random. It confuses users. That is, unless you're treating the web as an artistic medium (which would put you in a tiny minority of web designers) rather than as a way to deliver information and engage users.

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659264
Share on other sites

This is what I do for a living, so it's always on my mind. Like I said above though (in my code examples), even if it's just one link, there's still some reason. I can't remember a single time I've edited a site, built a comp, etc. where such a simple style was used only once in the site.

 

In any case, it's better to isolate the CSS in the <head> even with non-descriptive class names than to use inline styles which are pretty much unmaintainable.

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659270
Share on other sites

I never said it was bad, and tbh we don't need to know what you do for a living nor does it matter.

 

All I am saying is that there is no point for someone (who seems to have little HTML experience, and probably even less if any CSS) to make a style sheet, include it and apply it for one link.

 

If he asked how to do that we would have told him but the fact remains he asked how to make that link black and underlined.

 

 

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659272
Share on other sites

I mean, I explained the reasoning throughout and it's clear that the solution is a bit over-engineered for a single style change. But it surely doesn't hurt to educate, and your "who are you to assume..." stance contrasts pretty sharply with the fact that you don't like me suggesting useful, accurate, relevant information here. Next time I'll just highlight and bold "BAD" so that people insistent on judging a post based on a negative word can get to the point faster.

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659275
Share on other sites

tmallen, who said he wanted all of his links to not have the underlined mark?

 

a {
    text-decoration: none;
}

 

There may be ONE spot on his website, where a link needs to be without an underlined mark and all of his others are fine. Think of that one? Maybe he is making a website where you click a link and go to another page and there is only one link to click per page. Why? Who knows... he's making his website for his reasoning and I am sure there is one.

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659276
Share on other sites

Based on:

Ive added a hyperlink to our esite which is working but it appears underlined.

I made an educated guess that this was in adherence to some style guide, organized or not.

 

Also, even with one link per page, it still would become a maintenance nightmare pretty quickly. Linking to the stylesheet means you can use the same styles for each and every page, and you save a tiny amount of bandwidth (I remember when that was a big argument around '99 for CSS).

 

Of course, the chances that the OP continued following this thread after they found their solution is...

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659283
Share on other sites

@tmallen

Feel free to give advice, but don't tell people they are doing something bad just because it is not how you want it or would of done it, if you wish to educate him/her why did you not explain the good and bad points to using your way instead of just saying that his was is bad.

 

Maybe give him/her a link to a site like w3schools which can explain it better and more indepth.

 

This is nothing personal, just that you shouldn't assume that he/her want's to do something they didn't ask.

Ive added a hyperlink to our esite which is working but it appears underlined.

Link to comment
https://forums.phpfreaks.com/topic/127434-underlined-hyperlink/#findComment-659286
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.