❖ Link:
- Link is a connection from one web page to another web pages.
- Links can be styled with any CSS property (e.g. color, font-family, background, etc.).
- In addition, links can be styled differently depending on what state they are in. The four links states are:
- a:link - a normal, unvisited link
- a:visited - a link the user has visited
- a:hover - a link when the user mouses over it
- a:active - a link the moment it is clicked
Default value of links:
- By default the links created are underlined.
- When mouse is hovered above a link, it changes to a hand icon.
- Normal/unvisited links are blue.
- Visited links a colored purple.
- Active links are colored red.
- When a link is focused, it has an outline around it.
Example:
<html>
<head>
/* unvisited link */
a:link
{
color: red;
}
/* visited link */
a:visited
{
color: green;
}
/* mouse over link */
a:hover
{
color: hotpink;
}
/* selected link */
a:active
{
color: blue;
}
</head>
<body>
<a href=”a.html”>tulips</a>
<a href=”b.html”>tulips</a>
<a href=”c.html”>tulips</a>
<a href=”d.html”>tulips</a>
</body>
</html>
- In HTML, there are two main types of lists:
- unordered lists (<ul>) - the list items are marked with bullets
- ordered lists (<ol>) - the list items are marked with numbers or letters
- The CSS list properties allow you to:
- Set different list item markers for ordered lists
- Set different list item markers for unordered lists
- Set an image as the list item marker
- Add background colors to lists and list items
An Image as The List Item Marker:
- The list-style-image property specifies an image as the list item marker:
Example:
ul
{
list-style-image: url('tulips.jpg');
}
position the list item markers:
- The list-style-position property specifies the position of the list-item markers (bullet points).
- "list-style-position: outside;" means that the bullet points will be outside the list item. The start of each line of a list item will be aligned vertically. This is default.
- "list-style-position: inside;" means that the bullet points will be inside the list item. As it is part of the list item, it will be part of the text and push the text at the start:
Example:
<html>
<head>
<style type="text/css">
ul
{
background:red;
list-style-type:disc;
list-style-position:inside;
color:blue;
border : 2px solid red;
margin:20;
padding:5;
}
ol
{
background:green;
list-style-image:url("desert.jpg");
color:blue;
}
</style>
</head>
<body>
<ul>
<li>oracle</li>
<li>c lan</li>
<li>co</li>
<li>maths</li>
</ul>
<ol>
<li>abc</li>
<li>def</li>
<li>xyz</li>
<li>mno</li>
</ol>
</body>
</html>
0 Comments