• Hey Guest. Check out your NeoGAF Wrapped 2025 results here!

N00b HTML question

Status
Not open for further replies.

Rei_Toei

Fclvat sbe Pnanqn, ru?
When using <a href="url">text</a>, it uses bold to place emphasis on the url. How can you change this into underlined instead of bold?
 
Yes, but I just tried with IE - same problem. I'm messing around with asp, could that be the problem?
 
In general it's up to the browser to decide how it's going to display any given tag. Most of them will default to underline and a different colour for links.

There are a number of ways you can change that behaviour, but the most sensible is with CSS (Cascading Style Sheets) which you can learn about here. By the sounds of it there's already a CSS stylesheet associated with the document you're editing which changes the style of links. If you have access to that, you can change the link style there. If you don't, or if you don't want to change the style of all links, just a set few, then you should add a new style rule for a given class of links, which can be done in the main CSS or in the header of the document (see the tutorial for more details). The rule you'd want would be something like:
Code:
a.myLinks { font-weight: normal; text-decoration: underline }
And then you could declare your links as:
Code:
I learnt everything I know about HTML from <a class="myLinks" href="http://www.gaming-age.com">Gaming Age</a>!
 
If you don't have a CSS tag set up to make it bold, I'm not following you. It should look like everything else, just underlined.
Example: test page with the above code

Do you mean you don't want it in a different color and just to blend in with the rest of the page? If so, that should be done with CSS.
 
You can put these after TITLE and before BODY on your page and just set the #'s to whatever color you want for your text, that should help.

<LINK="######">

<ALINK="######">

<VLINK="######">
 
This whole thread is basically begging the question.

First off, what are you coding? why are you working with ASP if you're not that familiar with HTML? Are you coding off of someone else's page? What's the background here so we can understand why the page is bolding the links and removing their underlines in the first place...
 
Umm... I'm really a noob :lol. I'm working with a site that uses ASP. I'm familiar with the most basic HTML, but I didn't know how changing the visual presentation of linking worked. Turns out the CSS isn't gonna be changed just because I like underlined urls more then bold ones :D. Anyway, thanks a bunch for the help, it's really appreciated.
 
Rei_Toei said:
Umm... I'm really a noob :lol. I'm working with a site that uses ASP. I'm familiar with the most basic HTML, but I didn't know how changing the visual presentation of linking worked. Turns out the CSS isn't gonna be changed just because I like underlined urls more then bold ones :D. Anyway, thanks a bunch for the help, it's really appreciated.

You can still override the CSS, by adding your own definitions within the head of your own document. For example:
Code:
<head>
<style type="text/css">
a.specialLink { font-weight: normal; text-decoration: underline }
</style>
</head>
Then you can use
Code:
<a href="..." class="specialLink">link</a>
to use the new style.
 
You know you could just put it right into the tag:

Code:
<a style="font-weight: normal; text-decoration: underline;" url="http://www.ga-forum.com">
I learned my HTML from here!</a>

However this is not preferable as it defeats the purpose of using CSS.
 
Cool! But 'they' lurk here and already found out I was asking here :lol
sweat.gif
. But I'll try it out :). The purpose of CSS is consistency?
 
Rei_Toei said:
Umm... I'm really a noob :lol. I'm working with a site that uses ASP. I'm familiar with the most basic HTML, but I didn't know how changing the visual presentation of linking worked. Turns out the CSS isn't gonna be changed just because I like underlined urls more then bold ones :D. Anyway, thanks a bunch for the help, it's really appreciated.
Usability-wise, links should be underlined, at least when hovered-over (look at a lot of the links here on GAF, they underline on hover). I think that's why, intuitively, you'd prefer it that way. Another way you can change the style of individual tags by adding a style attribute:

<a href="/" style="font-weight: normal; text-decoration: underline;">Link</a>

That should override the page's default stylesheet definitions.

[EDIT: the point of CSS is to abstract the styling of a document from the structural components of that document; it helps with more than just adding consistency, it also makes going through code and editing structural & presentational elements a lot easier...]
 
APF said:
[EDIT: the point of CSS is to abstract the styling of a document from the structural components of that document; it helps with more than just adding consistency, it also makes going through code and editing structural & presentational elements a lot easier...]

Which is why inlining the style in the individual elements is Bad and wRong.
 
Aha. I guess I like underlined urls more from an aesthetic point of view, but perhaps that's just because it's more commonly used and therefore looks intuitively better.

HyperionX's code didn't work here, it didn't link. And when I added the '<a href="/' part to make it work, it started to a (dead) link on the site about content managment. But the code APF gave me did work. Thanks a lot all of you!
 
iapetus said:
Which is why inlining the style in the individual elements is Bad and wRong.
:P

But if you don't have access to the master stylesheet it's an option. Although there's also scripting... :)
 
Rei_Toei said:
Aha. I guess I like underlined urls more from an aesthetic point of view, but perhaps that's just because it's more commonly used and therefore looks intuitively better.

HyperionX's code didn't work here, it didn't link. And when I added the '<a href="/' part to make it work, it started to a (dead) link on the site about content managment. But the code APF gave me did work. Thanks a lot all of you!

Oops. Too much BBS code is bad for you. Yeah, it should've been <a href="...">
 
APF said:
Usability-wise, links should be underlined, at least when hovered-over (look at a lot of the links here on GAF, they underline on hover).

Yeah, you can also change styles on :hover like this:

Code:
<head>
<style type="text/css">
a.hoverlink {font-weight: normal; color:black; text-decoration: none; }
a.hoverlink :hover {text-decoration: underline; }
</style>
</head>

<a class="hoverlink" href="http://www.csszengarden.com">Link me!</a>

CSS has many more features, anyone interested should definitely check out some tutorials or sites that make heavy use of CSS.
 
APF said:
But if you don't have access to the master stylesheet it's an option.

As long as you also don't have access to the head of the document, yes. It's better than using stylistic HTML markup at least, though.
 
Status
Not open for further replies.
Top Bottom