Links (or Hyperlinks) are HTML elements by which we can open other pages, jump from one document to another or to another point on the same page.
The links can be created with <a>
tag.
<h4>Example link</h4> <p>This is a simple link.</p> <a href='/html' title='HTML Course'>HTML Course</a>
color
property.<style> /*links color */ a { color: #0000fe; } /*color when mouse is over the link */ a:hover { color: #00d000; } /*color of visited links */ a:visited { color: #fe0000; } </style>- Example:
<style> a { color: #f00000; } a:visited { color: #00d000; } a:hover { color: #0000e0; } </style> <h4>Example colored link</h4> <p>This is a link with color defined in CSS.</p> <a href='/html' title='HTML Course'>HTML Course</a>
<h4>Example link with image</h4> <p>Click the image to open the link.</p> <a href='/blog/' title='Spirituality'><img src='../imgs/smile_gift.png' alt='Smile' width='150' height='132'/></a>
1. Hyperlink to another document (called external links).
2. A bookmark inside a document, by using the 'id' attribute (called internal links).
These type of links open external documents. The URL address added in the 'href' attribute can be of two types:
<!-- The index.php page is in the same folder --> <a href='index.php' title='Free courses'>Home</a> <!-- The page.html is up one directory --> <a href='../page.html' title='Free courses'>Text</a> <!-- The page.html is in a sub-directory --> <a href='folder/page.html' title='Free courses'>Text</a>- Relative path is used only with documents which are on the same server.
An internal link allows you to jump to another section on the same page, so it basically scrolls the page up or down to the desired location.
To create an internal link you must follow these steps:
<a id='indice'> </a>- the 'id' attribute indicates the target for the link.
- the 'indice' can be any word, will be used in the 'href' attribute.
<h4>Example internal link</h4> <a href='#next1'>Next section</a> <p style='height:990px;'>Lots of paragraphs...<br> ...</p> <a id='next1'> </a> <p>Here is the next section.</p> <p>Everything is good and beautiful when you see it as it really is.</p><br>
Bookmarks are not displayed, they are invisible to the reader.
You can use the ID of any element in page as target and indice for hash '#' in 'href' ( href='#id_div' ).
The <a>
tag can have a target
attribute, which specifies where to open the linked document.
There are 4 special 'target' values:
<h4>Example link with target</h4> <p>The following link has target='_blank', will open the page in a new tab.</p> <a href='//gamv.eu/' target='_blank' title='Flash Games'>Flash Games</a>
<ul> <li>http://coursesweb.net/html/</li> <li>http://coursesweb.net/css/</li> </ul>
.some_class { display: list-item; }
var obj = { "courses": ["php", "javascript", "ajax"] }; var jsonstr = JSON.stringify(obj); alert(jsonstr); // {"courses":["php","javascript","ajax"]}
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>'; $dochtml = new DOMDocument(); $dochtml->loadHTML($strhtml); $elm = $dochtml->getElementById("dv1"); echo $elm->nodeValue; // CoursesWeb.net