0% found this document useful (0 votes)
77 views

HTML Styles CSS

CSS (Cascading Style Sheets) is used to format and style web pages. CSS allows you to control elements like color, font, layout, and other visual aspects of web pages. CSS can be added to HTML documents in three ways: inline, internal, or through an external style sheet. The most common method is to define styles for multiple pages in an external CSS file and link it to HTML pages.

Uploaded by

Joana Paola Gone
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

HTML Styles CSS

CSS (Cascading Style Sheets) is used to format and style web pages. CSS allows you to control elements like color, font, layout, and other visual aspects of web pages. CSS can be added to HTML documents in three ways: inline, internal, or through an external style sheet. The most common method is to define styles for multiple pages in an external CSS file and link it to HTML pages.

Uploaded by

Joana Paola Gone
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

HTML STYLES

CSS
HTML Styles CSS
CSS stands for Cascading Style Sheets.
CSS saves a lot of work. It can control the layout
of multiple web pages all at once.
What is CSS?
Cascading Style Sheets (CSS) is
used to format the layout of a
webpage.
With CSS, you can control the color, font, the size of text, the spacing
between elements, how elements are positioned and laid out, what
background images or background colors are to be used, different
displays for different devices and screen sizes, and much more!

Tip: The word cascading means that a style applied to a


parent element will also apply to all children elements
within the parent. So, if you set the color of the body text
to "blue", all headings, paragraphs, and other text
elements within the body will also get the same color
(unless you specify something else)
Using CSS
CSS can be added to HTML documents in 3 ways:

Inline - by using the style attribute inside HTML elements


Internal - by using a <style> element in the <head> section
External - by using a <link> element to link to an external CSS file

The most common way to add CSS, is to keep the


styles in external CSS files.
Inline CSS
An inline CSS is used to apply a unique style to a single
HTML element.
An inline CSS uses the style attribute of an HTML
element.
The following example sets the text color of the <h1>
element to blue, and the text color of the <p> element to
red:
Inline CSS
<!DOCTYPE html>
<html>
<body>

<h1 style="color:DarkGreen;">A Blue Heading</h1>

<p style="color:Crimson;">A red paragraph.</p>

</body>
</html>
Internal CSS
An internal CSS is used to define a style for a single
HTML page.
An internal CSS is defined in the <head> section of an
HTML page, within a <style> element.
The following example sets the text color of ALL the
<h1> elements (on that page) to blue, and the text color
of ALL the <p> elements to red. In addition, the page will
be displayed with a "powder blue" background color:
Internal CSS
Internal CSS
External CSS
An external style sheet is used to define the style for
many HTML pages.

To use an external style sheet, add a link to it in the


<head> section of each HTML page.
External CSS
External CSS
Tip: With an
external style
sheet, you can
change the
look of an
entire web
site, by
changing one
file!

The external style sheet can be written in any text editor. The file must not
contain any HTML code, and must be saved with a .css extension.

Here is what the "styles.css" file looks like:

You might also like