What Is The HTML Styles CSS

HTML CSS represents Cascading Style Sheets.

CSS saves a great deal of work. It can handle the design of numerous pages at the same time.

What is CSS?

Falling Style Sheets (CSS) is utilized to design the format of a page.

With CSS, you can handle the shading, textual style, the size of text, the separating between components, how components are situated and spread out, what foundation pictures or foundation tones are to be utilized, distinctive presentations for various gadgets and screen sizes, and substantially more!

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>component in the <head> area
  • Outer – by utilizing a <link>component to connection to an outside CSS document

The most widely recognized approach to add CSS, is to keep the styles in outside CSS documents. Notwithstanding, in this instructional exercise we will utilize inline and interior styles, since this is simpler to illustrate, and simpler for you to attempt it yourself.

Inline CSS

An inline CSS is utilized to apply a novel style to a solitary HTML component.

An inline CSS uses the style nature of a HTML segment.

The accompanying model sets the content shade of the component to blue, and the content shade of the component to red:

Example

<h1 style=”color:blue;”>A Blue Heading</h1>

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

Internal CSS

An inside CSS is utilized to characterize a style for a solitary HTML page.

An inside CSS is characterized in the<head> part of a HTML page, inside a <style> component.

The accompanying model sets the content shade of ALL the <h1> components (on that page) to blue, and the content shade of ALL the <p> components to red. Furthermore, the page will be shown with a “powderblue” foundation tone:

Example

<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1   {color: blue;}
p    {color: red;}
</style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

External CSS

An outside template is utilized to characterize the style for some, HTML pages.

To utilize an outside template, add a connection to it in the <head> part of every HTML page:

Example

<!DOCTYPE html>
<html>
<head>
  <link rel=”stylesheet” href=”styles.css”>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

The outer template can be written in any content tool. The record should not contain any HTML code, and should be saved with a .css expansion.

Here is what the “styles.css” record resembles:

“styles.css”:

body {
  background-color: powderblue;
}
h1 {
  color: blue;
}
p {
  color: red;
}

CSS Colors, Fonts and Sizes

Here, we will exhibit some regularly utilized CSS properties. You will get familiar with them later.

The CSS shading property characterizes the content tone to be utilized.

The CSS text style family property characterizes the textual style to be utilized.

The CSS text dimension property characterizes the content size to be utilized.

Example

Utilization of CSS tone, text style family and text dimension properties:<!DOCTYPE html>
<html>
<head>
<style>
h1 {
  color: blue;
  font-family: verdana;
  font-size: 300%;
}
p {
  color: red;
  font-family: courier;
  font-size: 160%;
}
</style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

CSS Border

The CSS line property characterizes a boundary around a HTML component.

Tip: You can characterize a boundary for practically all HTML components.

Example

Use of CSS border property: p {
  border: 2px solid powderblue;
}

CSS Padding

The CSS cushioning property characterizes a cushioning (space) between the content and the line.

Example

Use of CSS border and padding properties:p {
  border: 2px solid powderblue;
  padding: 30px;
}

CSS Margin

The CSS edge property characterizes an edge (space) outside the boundary.

Example

Use of CSS border and margin properties:p {
  border: 2px solid powderblue;
  margin: 50px;
}

Link to External CSS

Outside templates can be referred to with a full URL or with a way comparative with the current site page.

Example

This example uses a full URL to link to a style sheet:<link rel=”stylesheet” href=”https://www.example.com/html/styles.css”>

Example

This example links to a style sheet located in the html folder on the current web site: <link rel=”stylesheet” href=”/html/styles.css”>

Example

This example links to a style sheet located in the same folder as the current page:<link rel=”stylesheet” href=”styles.css”>

HTML Style Tags

TagDescription
<style>Defines style information for an HTML document
<link>Defines a link between a document and an external resource
HTML CSS