Welcome to WebmasterWorld Guest from 18.207.137.4

Forum Moderators: open

Message Too Old, No Replies

Help needed with basic html link

     
5:47 am on Feb 13, 2008 (gmt 0)

New User

10+ Year Member

joined:Feb 13, 2008
posts:3
votes: 0


I'm building my first site and am stuck trying to get an html link to look right. I'm using the code <a href="http://www.example.com"> Anchor Text </a> but what happens is that it looks like this when I upload my page:

I have a big fat

cat

that likes to sleep all day. (where the word cat is linked to another page)

But I want it to look like this:

I have a big fat cat that likes to sleep all day.

So my anchor text is linked to the page I want it to link to, but the linked word moves to it's own line rather than just staying within the sentence.

Does anyone know why this is happening? Hopefully my description of what's going on makes sense.

6:43 am on Feb 13, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Hello raylm123, and welcome to the forums.

This is not normal behavior for an anchor element (<a>) so I'm thinking there must be something else in the code. The anchor is behaving like a block level element rather than an inline element, which would be the default.

Do you have CSS associated with the page? It could be in an external document, in the <head> section of this document, or in the opening anchor tag itself. If so, that's the place to look.

Also, here are some helpful links when working with display issues:

W3C Validator - HTML [validator.w3.org]
W3C Validator - CSS [jigsaw.w3.org]

Some display issues can be impossible to resolve if certain kinds of invalid mark-up are involved, so it's always best to ensure the code is valid before moving on to de-bug rendering problems.

[edited by: tedster at 5:49 pm (utc) on Feb. 13, 2008]

8:05 am on Feb 13, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11846
votes: 242


welcome to WebmasterWorld [webmasterworld.com], raylm123!

a good tool to debug this type of problem is firefox with the Web Developer 1.1.4 extension.
it includes the w3c html validator, built into the "view source" feature.

3:30 pm on Feb 13, 2008 (gmt 0)

New User

10+ Year Member

joined:Feb 11, 2008
posts:1
votes: 0


It might also be worthwile adding the firefox plugin Firebug, this allows you to alter CSS attributes on the fly so you can see how thye would effect your page.
8:59 pm on Feb 13, 2008 (gmt 0)

New User

10+ Year Member

joined:Feb 13, 2008
posts:3
votes: 0


Thank you so much for the link to the validator tools. Those will be a tremendous help and have given me a starting place to look for the problem. I'm guessing it has something to do with my tags because all three of the html links on my page show up with a problem on the validator tool. So now I've got a starting point! :)

No, I'm not using CSS. (I don't even really know what that is).

Believe me, this is a true beginner's page. It only has three columns, some text, three links, and one image.

I've only just started getting my hands dirty with actual coding this week. I've always used a WYSIWYG editor (Homestead) to build my websites in the past but have been convinced by others that I really should learn to build them myself.

So here I am!

Thanks for all the friendly welcomes!

It's nice to finally find a site where the members are really helpful and no one is trying to sell you something.

10:48 pm on Feb 13, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11846
votes: 242


welcome to WebmasterWorld [webmasterworld.com], CaffinePhil!
11:18 pm on Feb 13, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:May 31, 2006
posts:116
votes: 0


Hey raylm123. Just out of curiosity, are you using a wysiwyg program like Dreamweaver or Frontpage to make the site? Sometimes they'll do some funky things you don't expect to links or other elements. I've found that if I have code like yours spread across a couple of lines that it sometimes actually throws a line break in there where there should be none.

Just a thought.

12:09 am on Feb 14, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 4, 2004
posts:892
votes: 3


....all three of the html links on my page show up with a problem on the validator tool

One thing to be aware of is one error can produce cascading errors, the second, third.... and others on the list may not be errors. Fix the first one and revalidate it.

4:52 am on Feb 14, 2008 (gmt 0)

New User

10+ Year Member

joined:Feb 13, 2008
posts:3
votes: 0


Thanks for the tips everyone. I'm using Coffee Cup's HTML Editor, not Dreamweaver or Frontpage. I'll have some time tomorrow night to play around with it so hopefully I'll be able to correct the problem then.

If not I'll be back for more suggestions. ;-)

11:59 am on Feb 14, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3150
votes: 4


If not I'll be back for more suggestions. ;-)

And even if you do solve your link problem, if you post your findings back here then someone will no doubt find it useful. And welcome again to WebmasterWorld :)

3:26 pm on Feb 14, 2008 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member piatkow is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 5, 2006
posts:3462
votes: 69


I guess you have been through the html of the page body to check for spurious P or BR tags. Even if you don't have the experience to debug CSS do check if your editor has created some styling, look at the page header and see if there are any style tags or a link to a .css file.