Coder's GroundWeb Development

What is CSS and why do you actually need to learn CSS?

As HTML lets you Build a webpages, CSS is more of a styling language, which takes your simple boring HTML webpage lets you turn it into a fancy modern website. In today’s web development market, it is as important as HTML because hey, nobody likes white webpages with nothing fancy going on with it.

Let’s understand what is CSS:-

  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS file

Note – CSS use for designing on the webpage.

How to Use Styles When a browser reads a style sheet, it will format the document according to it. There are three ways of inserting a style sheet:

  • External style sheet
  • Internal style sheet (Embedded)
  • Inline styles

External Style

Sheet An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the <head> section:

Example:-

<head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head>

Internal Style Sheet (Embedded)

An internal style sheet can be used if one single document has a unique style. Internal styles are defined in the <head> section of an HTML page, by using the <style> tag, like this:

Example:-

<head> <style type="text/css"> body {background-color:yellow;} p {color:blue;} </style> </head>

Inline Styles

An inline style can be used if a unique style is to be applied to one single occurrence of an element. To use inline styles, use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example below shows how to change the text color and the left margin of a paragraph:

Example:-

<p style="colo r:blue;margin-left:20px;">This is a paragraph.</p>

HTML Style Tags:-

1.<style>- Defines style information for a document

2.<link>- Defines the relationship between a document and an external                               resource

Also read, Some common HTML Tags and their uses , Top free python courses on Internet

Surabhi Singh

You may also like

1 Comment

Leave a reply

Your email address will not be published. Required fields are marked *