WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

CSS How to


In this section find out about css types


Three strategies to Insert CSS

There are three strategies for embeddings a style sheet:

  • Internal style sheet
  • External style sheet
  • Inline style

Internal Style Sheet

internal template utilized for one single page(unique style)

Internal styles : it is a <style> component, put inside the <head> segment of a HTML page:

Example

<head>
<style>
body {
    foundation shading: #A0CC1C;
}

h1 {
    shading: #CC5A3D;
    edge left: 20px;
}
</style>
</head>
Try it yourself »

Inline Styles

Inline styles used to include a one of a kind style for one component.

To use inline styles, add the style credit to the significant component. The style characteristic can contain any CSS property.

The model beneath tells You see single component the best way to change the shading and the left edge of a <h1> element:

Example

<h1 style="color:#A0CC1C;margin-right:10px;">This is a heading.</h1>
Try it yourself »

External Style Sheet

External style sheetThis is great technique for change whole site look utilizing one .css file

Each page must incorporate a reference to the outside template document inside the <link> component. The <link> component goes inside the <head> section:

Example

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Try it yourself »

External template record augmentation is .css . We can utilize any word processor yet document not contain any html labels . The template document must be spared with a .css extension.

Here is the manner by which the "myStyle.css" looks:

body {
    foundation shading: #A0CC1C;
}

h1 {
    shading: #CC5A3D;
    edge left: 20px;
}

Multiple Style Sheets

If a few properties have been characterized for a similar selector (component) in various templates, the incentive from the last perused template will be used. 

Example

Assume that an outside template has the accompanying style for the <h1> element:

h1 {
    shading: #A0CC1C;
}

then, accept that an inside template likewise has the accompanying style for the <h1> element:

h1 {
    shading: #CC5A3D;   
}

internal style is subtleties after the connection to the outside template, the <h1> components will be "#CC5A3D":

Example

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<style>
h1 {
    shading: #A0CC1C;
}
</style>
</head>
Try it yourself »

If the inner style is characterized before the connection to the outside template, the <h1> components will be "#A0CC1C":

Example

<head>
<style>
h1 {
    shading: #A0CC1C;
}
</style>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Try it yourself »