Tuesday, May 13, 2014

HTML Links

// // Leave a Comment

An anchor tag (a) is used to define a link, but you also need to add something to the anchor tag - the destination of the link.

HTML Link Syntax

The HTML code for a link is simple. It looks like this:
<a href="url">Link text</a>
The href attribute specifies the destination of a link.
Example:
<a href=”http://www.developersplatform.byethost5.com/”>Visit Developers Platform</a>
This will be look like this: Visit Developers Platform

HTML Links - The target Attribute

The target attribute specifies where to open the linked document.
The example below will open the linked document in a new browser window or a new tab:
<a href="http://www.developersplatform.byethost5.com/" target="_blank">Visit Developersplatforma</a>

HTML Head

The <head> element is container for all the head elements.
The following tags can be added to the head section:
<title>, <meta>, <style>, <script>, <link>, <noscript>, <base>
<!DOCTYPE html>
<html>
<head>
<title>title of the document</title>
<meta name=”keywords” content=”HTML, CSS, HTML5, CSS3”>
<body>

The HTML <base> Element

The <base> tag specifies the base URL/target for all relative URLs in a page:
<head>
<base href="http://www.developersplatform.byethost5.com/images/" target="_blank">
</head>


The HTML <link> Element

The <link> tag defines the relationship between a document and an external resource.
The <link> tag is most used to link to style sheets:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>


The HTML <style> Element

The <style> tag is used to define style information for an HTML document.
Inside the <style> element you specify how HTML elements should render in a browser:
<head>
<style type="text/css">
body {background-color:yellow;}
p {color:blue;}
</style>
</head>


The HTML <meta> Element

Metadata is data (information) about data.
The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable.
Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata.
The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.
<meta> tags always go inside the <head> element.
Define keywords for search engines:
<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">
Define a description of your web page:
<meta name="description" content="Free Web tutorials on HTML and CSS">
Define the author of a page:
<meta name="author" content="Hege Refsnes">
Refresh document every 30 seconds:
<meta http-equiv="refresh" content="30">

0 comments:

Post a Comment