HTML CSS

HTML
CSS
C#
SQL

HTML CSS

HTML CSS are used to control the presentation and appearance of web page content. Styles allow you to define how elements are displayed, such as their colors, fonts, sizes, spacing, and more. Styles make your web page visually appealing and help create a consistent look and feel.

Inline Styles
One way to apply styles to HTML elements is by using inline styles. Inline styles are defined directly within the HTML element using the `style` attribute. Here’s an example:

<p style=”color: blue; font-size: 16px;”>This is a blue, 16px text.</p>

In this example, the `style` attribute is used to set the text color to blue and the font size to 16 pixels for the `<p>` element.

Internal Styles
Internal styles are defined within the `<style>` element in the `<head>` section of an HTML document. They apply to multiple elements on the page. Here’s an example:

In this example, the internal style sets the text color to green and the font size to 18 pixels for all `<p>` elements on the page.

External Styles
External styles are defined in separate CSS (Cascading Style Sheets) files and linked to the HTML document using the `<link>` element in the `<head>` section. External styles allow you to maintain a consistent look across multiple pages. Here’s an example:

Create a file named `styles.css` with the following content:

p {
 color: red;
 font-size: 20px;
}






Then, link it to your HTML document:

<!DOCTYPE html>
<html>
<head>
<link rel=”stylesheet” type=”text/css” href=”styles.css”>
</head>
<body>
<p>This is red, 20px text.</p>
<p>Another red, 20px text.</p>
</body>
</html>

In this example, the external style in `styles.css` sets the text color to red and the font size to 20 pixels for all `<p>` elements on the page.
HTML styles give you the flexibility to control the visual aspects of your web pages, ensuring they look and feel the way you want them to.