Reputation: 19
I'm attempting to learn some HTML on my own and I'm starting out with some very basic formatting and linking:
<!DOCTYPE html>
<html>
<body>
<h1> First Heading </h1>
<a href = “http://www.stackoverflow.com” target=“_blank”>TEST LINK</a>
</body>
</html>
I saved the file as .html
and it opens correctly in any browser like I would expect, but when attempting to click the link, the browser displays a 'website not found' message. The URL shows the directory to the folder on my computer where I created the HTML
document followed by http://www.stackoverflow.com.
I feel like this is a formatting issue but I have tried all kinds of variations of the notation. Any help is appreciated.
Edit:
Thanks for the help guys! I think TextEdit is just the source of the problem. I wrote a new HTML
file in VIM and everything is working perfectly.
Upvotes: 0
Views: 113
Reputation: 61
Don't use ”
. Instead, use the double quote sign ("
) for all links and attributes.
Check the following code:
<!DOCTYPE html>
<html>
<body>
<h1> First Heading </h1>
<a href = "http://www.stackoverflow.com" target="_blank">TEST LINK</a>
</body>
</html>
Upvotes: 0
Reputation: 709
You are using the wrong kind of quotes. ”
should be "
. When copying/pasting code, always make sure to do by pasting the value. Here's the code with correct quotes:
<!DOCTYPE html>
<html>
<body>
<h1> First Heading </h1>
<a href = "http://www.stackoverflow.com" target="_blank">TEST LINK</a>
</body>
</html>
Upvotes: 1
Reputation:
you have a typo with your "
. Just re-type them:
<a href="http://www.stackoverflow.com" target="_blank">TEST LINK</a>
Upvotes: 1
Reputation: 341
Your quotes are wrong for both the href attribute and the target attribute.
Try using " " like so:
<a href="http://www.google.com" target="_blank">Link to Google</a>
You can use both single quotes ' ' and double quotes " " for the attribute values, but it is recommended that you use double.
Upvotes: 0
Reputation:
You have a typo because you used wrong quotes.
Change this:
<a href = “http://www.stackoverflow.com” target=“_blank”>TEST LINK</a>
To:
<a href="http://www.stackoverflow.com" target="_blank">TEST LINK</a>
Upvotes: 2