Home >> HTML 5 >> What is CSS in HTML 5

What is CSS in HTML 5

CSS stands for Cascading Style Sheets is used to style and layout web pages.

CSS used in HTML pages by three ways-

1)-Inline style - Using the style attribute in the HTML start tag.

2)-Embedded style - Using the <style> element in the head section of the document.

3)-External style - Using the <link> element, pointing to an external CSS files.

Inline Styles
Inline styles are used to apply the unique style rules to an element, by putting the CSS rules directly into the start tag.
It can be attached to an element using the style attribute.

Example

<html>
<head>
</head>
<body>
       <p style="background-color:red;">This is a paragraph.</p>
       <p style="background-color:green;">This is a paragraph.</p>
</body>
</html>

Embedded style
Embedded style sheets are defined in the <head> section of an HTML document using the <style> tag. 
You can define any number of <style> elements inside the <head> section.

Example

<html>
<head>
    <style>
        body { background-color: green; }
        p { color: red; }
    </style>
</head>
<body>
       <p>This is a paragraph.</p>
       <p>This is a paragraph.</p>
</body>
</html>

External Style
An external style sheet is applied to many pages.

Example

<html>
<head>
    <link rel="stylesheet" href="css/styles.css">
</head>
<body>
     <p>This is a paragraph.</p>
     <p>This is a paragraph.</p>
</body>
</html>

Post Your Comment

Next Questions
What is Links
What is Images
What is Favicon
What is Tables
What is Table Borders
What is Table Sizes
What is Table Headers
What is Table Padding and Spacing
What is Table Colspan and Rowspan
What is Table Styling
What is Table Colgroup
How many type of Lists
What is Unordered Lists
What is Ordered Lists
What is Block and Inline Elements
What is HTML class Attribute
What is HTML id Attribute
What is HTML Iframes
What is HTML JavaScript
What is HTML File Paths
What is HTML Head Element
What is HTML Layout
What is HTML Responsive Website Design
What is HTML Forms
What is HTML Form Attributes

Copyright ©2022 coderraj.com. All Rights Reserved.