HTML Color CSS And Links HTML colors can be specified using color names, hexadecimal codes, or RGB values and CSS (Cascading Style Sheets) is a stylesheet language used to control the presentation of a web page by specifying styles for HTML elements. HTML links, specified using the <a>
element, create hyperlinks between web pages with the URL being defined by the href
attribute.
Colors can be specified in several ways, including:
- Using color names: Color names are predefined names for common colors, such as “red”, “blue”, “green”, etc. For example:
<p style="color: red;">This is a red paragraph.</p>
- Using hexadecimal codes: Hexadecimal codes are six-digit codes that represent the amount of red, green, and blue (RGB) in a color. For example:
<p style="color: #ff0000;">This is a red paragraph.</p>
- Using RGB values: RGB values are specified using the
rgb()
function and represent the amount of red, green, and blue in a color. For example:
<p style="color: rgb(255, 0, 0);">This is a red paragraph.</p>
CSS (Cascading Style Sheets) is a stylesheet language used to control the presentation of a web page. It allows you to specify styles for HTML elements, such as color, font, size, spacing, and more. CSS can be specified in several ways, including:
Inline styles:
Inline styles are specified directly within an HTML element using the style
attribute. For example:
<p style="color: red; font-size: 20px;">This is a red and large paragraph.</p>
- Internal styles: Internal styles are specified within the
<head>
section of an HTML document using the<style>
element. For example:
<head>
<style>
p {
color: blue;
font-size: 20px;
}
</style>
</head>
<body>
<p>This is a blue and large paragraph.</p>
<p>This is another blue and large paragraph.</p>
</body>
External styles:
External styles are specified in a separate CSS file and linked to an HTML document using the <link>
element in the <head>
section. For example:
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<p>This is a green and large paragraph.</p>
<p>This is another green and large paragraph.</p>
</body>
With the external styles, the styles are defined in a separate file style.css
:
p {
color: green;
font-size: 20px;
}
HTML links are used to create hyperlinks between web pages. They can be specified using the <a>
element. For example:
<a href="https://www.google.com/">This is a link to Google</a>
In this example, the href
attribute specifies the URL of the linked page, and the text within the <a>
tags is the text that will be displayed as a link. When the user clicks on the link, they will be taken to the specified URL.