...

View Full Version : Text dissapears when i add an <a href> link



webnewb
06-29-2010, 03:12 PM
Hi guys, im having a problem which i have tried to solve myself for the past two hours but cant figure it out, ive only just started with html so im sorry if its a dumb question, anyway here goes the code below is what i am using

<?xml version= "1.0"ecoding = "UTF - 8"?>
<DOCTYPE html PUBLIC "- //WC3//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml " xml:lang="en">

<head>
<title> The Shop </title>
</head>

<body style="background-color:#00cc00;>

<h1> Welcome To The Shop </h1>
<p>
bla bla bla text.
</p>

<a href="shop.htm"> Shop </a>

<a href=http://www.shop.com> The world's Largest shop </a>

</body>


</html>

when it is like it is above i can see the main body text, but whenever i add another link like the code below you cant see the second link, can any1 please help?

<?xml version= "1.0"ecoding = "UTF - 8"?>
<DOCTYPE html PUBLIC "- //WC3//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml " xml:lang="en">

<head>
<title> The Shop </title>
</head>

<body style="background-color:#00cc00;>

<h1> Welcome To The Shop </h1>
<p>
bla bla bla text
</p>

<a href="shop.htm"> the Shop </a>

<a href=http://www.shop.com> the shop </a>

</body>








</html>

skywalker2208
06-29-2010, 03:37 PM
For one thing your body style does not have a closing double quote and your "the shop" link does not have double quotes around the href="".

webnewb
06-29-2010, 04:02 PM
thanks skywalker updated those but issue still exisits, any suggestions?

Kor
06-29-2010, 04:06 PM
Use HTML Doctype and notation, not XHTML. XHTML was made to handle XML objects within HTML, which I doubt it is your case, and it has some strict rules. HTML 4.01 is enough.

webnewb
06-29-2010, 04:14 PM
Hi Kor,

Thanks for your help, but what exactly does


Use HTML Doctype and notation, not XHTML. XHTML was made to handle XML objects within HTML, which I doubt it is your case, and it has some strict rules. HTML 4.01 is enough.

mean? does it mean change the coding at the top just to say <html>? rather than all the xml stuff? if so do i delete all the xml stuff as i got it out of sams teach yourself html and css in 24 hours book.

thanks again for helping

Kor
06-29-2010, 04:17 PM
About Doctype:
http://www.w3schools.com/tags/tag_DOCTYPE.asp?PHPSESSID=14eb1802ceb1a3d0e6e6777008520db9
About XHTML syntax:
http://www.w3schools.com/xhtml/

webnewb
06-29-2010, 04:53 PM
heres the new and updated code, still the link to the 'pokershop' doesnt work, sorry to keep bothering you and thanks for the help so far, can you see why it isnt showing up? p.s ive tried shortening the link to pokershop.htm as its in the same folder but it still doesnt work

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head>
<title> The One Stop Poker Shop </title>
</head>

<body style="background-color:#00cc00;">

<h1> Welcome To The One Stop Poker Shop </h1>
<p>
The One Stop Poker Shop is the largest private poker network.
We supply top of the range poker accessories for that tournament
poker experience in your own home. Whether your playing a home
game vs a mate or two or playing a home game vs a group of individuals
the best way to impress them is with professional poker accessories and
we've got it all lined up for you in our poker shop! Click below to check out our amazing range
of poker goodies from top of the range poker tables to top of the range card shufflers!
</p>

<a href="C:\Users\Dan and Ash\Desktop\Sams HTML and CSS\pokershop"> Poker Shop </a>

<a href="http://www.pokerstars.com"> The world's Largest Online Poker Network </a>

</body>


</html>

jfreak53
06-29-2010, 05:04 PM
Two things, one put a <br> in between the link to new line it.

Second if your using a local file on windows run it like this:

<a href="file:///C:/Users/Dan and Ash/Desktop/Sams HTML and CSS/pokershop"> Poker Shop </a>

Apostropartheid
06-30-2010, 12:20 AM
Two things:
1) Why are you using a Transitional DTD? This is a new document. You should only ever use Strict.
2) Why do you keep putting spaces between tags and text? It's weird.

Actually I have a couple more:
3) You shouldn't really use inline CSS. It really defeats the whole point in it. Use a style block in development if you really like all your code on one page, but you should move it to an external stylesheet before putting it live.
4) If you can, use a relative path. This means you don't have to update all your links when you post your pages online. In the end, it's a lot cleaner. What jfreak gave you may actually work, but spaces are invalid in URIs.

webnewb
06-30-2010, 01:46 PM
Hi apost, thanks for your feedback here are the answers to your questions,



1) Why are you using a Transitional DTD? This is a new document. You should only ever use Strict.

Im using transitional DTD because im not sure of the excaxt document type i should be using, could you show me the exact code i should put at the head of each document? i was using the latest xhtml document type as sams teach yourself css and html in 24 hours said to do so but others have told me not to, what should i actually be doing?




2) Why do you keep putting spaces between tags and text? It's weird.

The book told me to keep things 'spacey' to make it easier to read, but i wont from now on if its wierd lol. sorry didnt realise it was wrong.


3) You shouldn't really use inline CSS. It really defeats the whole point in it. Use a style block in development if you really like all your code on one page, but you should move it to an external stylesheet before putting it live.


Could you please tell me what inline css is? are there more than one type of css? i have no idea, if thats a stupid question im sorry


4) If you can, use a relative path. This means you don't have to update all your links when you post your pages online. In the end, it's a lot cleaner. What jfreak gave you may actually work, but spaces are invalid in URIs.

I will try to use relative paths where possible,

thanks for all your input i really do appreciate it

jfreak53
06-30-2010, 02:01 PM
Doctype:
http://www.w3schools.com/tags/tag_DOCTYPE.asp


The book told me to keep things 'spacey' to make it easier to read, but i wont from now on if its wierd lol. sorry didnt realise it was wrong.

By spacy it meant correct programming spaces not space between tags and content, like this:


<html>
<head>
<title>MyTitle</title>
</head>

<body>
<p>Text</p>
</body
</html>

Basically correctly formated code spacing.

First off learn correct CSS placement and the way to correct write, either here:

http://www.tizag.com/cssT/index.php

Or the W3:

http://www.w3schools.com/css/

By style block apos was talking about this:


<html>
<head>
<style type="text/css">

p {color: white; }
body {background-color: black; }
</style>
</head>

It's a style block for everything inside the head tag of your document. But even that defeats the purpose and I think apos would agree with me use external, that way it can be once written for multiple pages:


<head>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>

And I didn't get into the relative path thing because I kind of thought it was mute since he was using a Windows directory path on a windows machine, I didn't really think he was going to run it like that publicly, I think I might have been wrong.

Yes always relative or if you can run it with the http url, but never use the local directory path, ever. And yes spaces are invalid, that's why you see a lot of url's with "%20" in them. But again thought it might be mute since the way he was running it anyways.

I go over this time and time again with clients who upload pictures, why can't I have spaces and the wierd names I call my pictures, ha ha, it's fun ha ha.

Apostropartheid
06-30-2010, 02:54 PM
You should use only XHTML 1.0 Strict or HTML 4.01 Strict DOCTYPES (go with the first here.)

Also, jfreak (offtopic), the word you're looking for is "moot" :P

webnewb
06-30-2010, 03:00 PM
thanks jfreak that post helped alot, im using the links you have supplied now in an attempt to get a better grasp on things, i've thanked you officially through the 'thank user' button.

Also jfreak, would you mind swapping emails as i have found your advice very helpful and i could possibly email you with future questions should i have any? If so my email is dj.cassidy@yahoo.com

Many thanks again

webnewb
06-30-2010, 03:09 PM
Hi apost,

is this the doctype you reccomend i use?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

thanks

jfreak53
06-30-2010, 03:59 PM
Also, jfreak (offtopic), the word you're looking for is "moot" :P

Ha ha ha ha thank you :thumbsup: I was scratching my head trying to remember how to spell that stupid word!! ha ha, it was early what do you expect :p

jfreak53
06-30-2010, 04:01 PM
Hi apost,

is this the doctype you reccomend i use?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

thanks

No that's a transitional doctype, he meant a strict one:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

That one is XHTML Strict.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum