You are on page 1of 2

Powered by AI

Bing

Sure, let’s continue with CSS.

CSS has three types of stylesheets: Inline, Internal, and External.

1. Inline Styles: These are used within the HTML elements using the style attribute. However, this method is
not recommended as it mixes HTML with CSS.

Example:
<p style="color:red;">This is an inline CSS example.</p>

2. Internal Styles: These are defined in the <head> section of the HTML document within <style> tags.

Example:
<head>
<style>
p {
color: blue;
}
</style>
</head>

3. External Styles: These are the most common method for applying CSS, where CSS rules are put in a
separate file with a .css extension. This file is then linked to the HTML document using the <link> element.

Example:
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>

In the external stylesheet styles.css:

p {
color: green;
}

Each method has its use cases, but external stylesheets are generally preferred for their scalability and
maintainability.

Next, let’s talk about CSS selectors. They are used to select and manipulate HTML elements based on their id,
class, type, attribute, and more. Here are some basic selectors:

• Type Selector: Selects HTML elements based on the element type.


p {
text-align: center;
color: red;
}

• Class Selector: Selects HTML elements based on the class attribute. It’s defined with a ..

.center {
text-align: center;
color: red;
}
• ID Selector: Selects HTML elements based on the id attribute. It’s defined with a #.

#para1 {
text-align: center;
color: red;
}

There’s a lot more to CSS, including more complex selectors, the box model, positioning, animations, and
responsive design techniques. But this should give you a good start! Let me know if you have any specific
questions.

You might also like