×

How To Use CSS

You can use CSS(Cascading Style Sheet) in four ways. These are given below: The given above CSS type, in which various technique will be used. These are different from each other and their different advantages.
  • Embedded or Internal CSS
  • Inline style
  • External style sheet
  • Imported CSS

Embedded or Internal Style Sheet

An Embedded or Internal Style Sheet is used in only one single page. It is define within <style> element inside the <head> section. Let us see an example of CSS embedded or internal style sheet:

Example of Internal Style Sheet

<head>  
<style>  
body {    
      background-color: white;    
      }    
p{    
    color: black;    
    border:2px solid red;    
}     
</style>  
</head>
Try Now

Inline Style Sheet

An Inline Style Sheet used with a unique style for a single element. You must have to used style attribute to the element.

sheds plans Hip Roof Shed Plans 10×18 Clerestory Dormer Shed Plans 20×12 Let us see an example of CSS inline style sheet:

<p  style="text-align:center;  color:blue">  We  are learning  how to use inline Style </p>

External Style Sheet

In External Style Sheet can use <linl> element to include an external stylesheet file. The style file extension must be .css . you can access style sheet in different web pages by using link the style sheet. Let us see an example of CSS external style sheet:
<head>  
   <link type = "text/css" href = "style.css">  
</head>
/*========= Save it name with style.css ===========*/  
body{  
     Background-color: gray;  
     }  
h1 {  
   color: blue;  
   text-transform: lowercase;  
   }

Import Style Sheet

In Import Style Sheet, @import is used to import an external stylesheet with in <head> element. Let us see an example of CSS import style sheet:
<head>  
   @import "importedstyle.css";  
</head>

Related Topics

How to get rid/remove of bullet pioints in CSS

We include a list of items on the web pages that were sometimes numbered and sometimes bulleted in various styles. In HTML, there are two kinds of lists: ordered and unordered...

3 minutes read.

CSS Loader

CSS Loader The loader is the animation that can alert a visitor regarding the loading of the page. We need to wait for some time. It will be helpful if any...

4 minutes read.

CSS Images

Images in CSS: Images are a critical part of a web application. It includes various types of images in the web application that cannot be recommended. However, it is essential...

4 minutes read.

CSS Display

CSS Display: The CSS Display property is one of an essential property among all other properties of CSS. The display property specifies how the HTML elements should be displayed on...

4 minutes read.

How to resize an image in CSS

How to resize an image in CSS? The resize image attribute is used in responsive web design to resize images to fit within the div container automatically. The resize image attribute...

3 minutes read.

CSS translate() Function

Translate() CSS function This function in CSS is a CSS in-built function. It relocates the element in the horizontal direction or in the vertical direction. It can move the items from...

2 minutes read.

CSS Word Wrap

Word Wrap in CSS: The word-wrap property in CSS is referred to break any lengthy word and wrap towards the next or following line. It is employed for preventing overflow...

1 minute read.

CSS Tutorial

CSS refers to the Cascading Style Sheet. CSS is a form of a programming language. In other words, CSS is a language of the style sheet that is utilised for...

9 minutes read.

CSS Text-decoration

CSS Text-decoration: It is an essential property of CSS that is used to decorate the content of the text. It can add-on the lines above, under, and over the text....

3 minutes read.

CSS Vertical Align

Vertical Align The vertical align CSS property describes the cell box of the table and an inline alignment vertically. This property is a self-explanatory and an essential property in CSS. But,...

2 minutes read.

CSS User Interface

Introduction User Interface can be defined as series of visual elements like screens, buttons, forms that help the user interact with the software application or hardware device. CSS User Interface allows the...

6 minutes read.

CSS Sticky

CSS Sticky The position property in CSS is applied to set an element’s position. This property is also applied to position an element behind the other element. It is useful for...

1 minute read.

CSS Text-Overflow

Introduction: The text-overflow property of CSS is used to format the text which is overflowing the boundaries of the container. This property helps user to clip the text, to display the...

5 minutes read.

How to change font size in CSS

How to change font size in CSS? Font Size: - Users may attract attention to content on a website page in various ways. One element in a sentence can be highlighted. You...

5 minutes read.

How to use google fonts in CSS

Fonts: - Fonts are used to make our website look more beautiful. Choosing appropriate font according to the web design or layout is also important. Many typefaces are accessible in...

4 minutes read.

CSS Image Gallery

Image galleries are used to display and store collections of images. Example Let’s discuss an example. CSS was used to create the following image gallery: Code is as follows: <html> <head> <style> div.gallery {   margin: 6px;   border: 1px...

5 minutes read.

CSS :root selector

CSS :root selector This CSS pseudo-class matches any document’s root element. It chooses the parent of the highest-level inside the document DOM or tree. An element of <html> is always a...

2 minutes read.

Css Text Orientation

Introduction: The text-orientation property of CSS is used to specify the orientation of the text characters in the line of content. This property applies only with the vertical writing-mode and not...

4 minutes read.

CSS Align

CSS Center Align Elements CSS center align is used to create align by using block element. You should specify margin: auto;properties. The element will take up the specified width and the remaining space....

2 minutes read.

CSS Background

CSS Background The properties of CSS background are applied to describe the effects of background on the element. Here are five properties of background that affects various elements of HTML: Background-colorBackground-imageBackground-repeatBackground-attachment Background-position Background-color The color of the background...

7 minutes read.