Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-29-2010, 03:12 PM   PM User | #1
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
Text dissapears when i add an <a href> link

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>

Last edited by webnewb; 06-29-2010 at 03:15 PM..
webnewb is offline   Reply With Quote
Old 06-29-2010, 03:37 PM   PM User | #2
skywalker2208
Regular Coder

 
Join Date: Jan 2009
Posts: 193
Thanks: 0
Thanked 20 Times in 20 Posts
skywalker2208 is an unknown quantity at this point
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="".
skywalker2208 is offline   Reply With Quote
Old 06-29-2010, 04:02 PM   PM User | #3
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
updated those

thanks skywalker updated those but issue still exisits, any suggestions?
webnewb is offline   Reply With Quote
Old 06-29-2010, 04:06 PM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 06-29-2010, 04:14 PM   PM User | #5
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
Kor

Hi Kor,

Thanks for your help, but what exactly does

Quote:
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
webnewb is offline   Reply With Quote
Old 06-29-2010, 04:17 PM   PM User | #6
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
About Doctype:
http://www.w3schools.com/tags/tag_DO...e6777008520db9
About XHTML syntax:
http://www.w3schools.com/xhtml/
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 06-29-2010, 04:53 PM   PM User | #7
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
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>

Last edited by webnewb; 06-29-2010 at 04:56 PM..
webnewb is offline   Reply With Quote
Old 06-29-2010, 05:04 PM   PM User | #8
jfreak53
Regular Coder

 
jfreak53's Avatar
 
Join Date: May 2004
Location: Guatemala
Posts: 477
Thanks: 19
Thanked 10 Times in 10 Posts
jfreak53 is an unknown quantity at this point
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:
Code:
<a href="file:///C:/Users/Dan and Ash/Desktop/Sams HTML and CSS/pokershop"> Poker Shop </a>
__________________
"FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
http://www.microtronix-tech.com -- Web design and programming
jfreak53 is offline   Reply With Quote
Old 06-30-2010, 12:20 AM   PM User | #9
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
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.
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Users who have thanked Apostropartheid for this post:
webnewb (06-30-2010)
Old 06-30-2010, 01:46 PM   PM User | #10
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
Hi Apost

Hi apost, thanks for your feedback here are the answers to your questions,


Quote:
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?



Quote:
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.

Quote:
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

Quote:
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
webnewb is offline   Reply With Quote
Old 06-30-2010, 02:01 PM   PM User | #11
jfreak53
Regular Coder

 
jfreak53's Avatar
 
Join Date: May 2004
Location: Guatemala
Posts: 477
Thanks: 19
Thanked 10 Times in 10 Posts
jfreak53 is an unknown quantity at this point
Doctype:
http://www.w3schools.com/tags/tag_DOCTYPE.asp

Quote:
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:

Code:
<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:

Code:
<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:

Code:
<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.
__________________
"FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
http://www.microtronix-tech.com -- Web design and programming
jfreak53 is offline   Reply With Quote
Users who have thanked jfreak53 for this post:
webnewb (06-30-2010)
Old 06-30-2010, 02:54 PM   PM User | #12
Apostropartheid
The Apostate


 
Apostropartheid's Avatar
 
Join Date: Oct 2007
Posts: 3,215
Thanks: 16
Thanked 265 Times in 263 Posts
Apostropartheid is on a distinguished road
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
__________________
Blog | Twitter
Useful links: W3C HTML Validator | W3C CSS Validator | HTML 5 Guide
CF: HTML & CSS Resources/Tutorials Thread | HTML & CSS Posting Rules and Guidelines
Remember: no link, no code, no help!
Apostropartheid is offline   Reply With Quote
Old 06-30-2010, 03:00 PM   PM User | #13
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
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 is offline   Reply With Quote
Old 06-30-2010, 03:09 PM   PM User | #14
webnewb
New Coder

 
Join Date: Jun 2010
Location: Hampshire, England
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
webnewb is an unknown quantity at this point
Hi Apost

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

Last edited by webnewb; 06-30-2010 at 03:18 PM..
webnewb is offline   Reply With Quote
Old 06-30-2010, 03:59 PM   PM User | #15
jfreak53
Regular Coder

 
jfreak53's Avatar
 
Join Date: May 2004
Location: Guatemala
Posts: 477
Thanks: 19
Thanked 10 Times in 10 Posts
jfreak53 is an unknown quantity at this point
Quote:
Originally Posted by Apostropartheid View Post
Also, jfreak (offtopic), the word you're looking for is "moot" :P
Ha ha ha ha thank you I was scratching my head trying to remember how to spell that stupid word!! ha ha, it was early what do you expect
__________________
"FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
http://www.microtronix-tech.com -- Web design and programming
jfreak53 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:56 AM.


Advertisement
Log in to turn off these ads.