English

Cascading Style Sheets in HTML5

Advertisements
  • CSS Syntax
  • Types of CSS
  • CSS Properties
  • CSS Id Selector 
  • CSS Class Selector
  • Universal Selector
  • Group Selector
  • Positioning in CSS
  • Float Property
  • Display property

Cascading Style Sheets(CSS) in HTML5

CSS defines how HTML elements are displayed across various media, saving effort by controlling the layout of multiple web pages simultaneously. It allows you to manage the appearance of several pages through a single source. 

CSS Syntax 

H1{color:yellow; font-size:11px}. There are two parts of a CSS syntax. First is the selector which indicates the HTML element you want to style. Second is the declaration Block which controls the attributes that you want to change. 

Types of CSS 

There are three methods of applying CSS. First is the Inline CSS, which is applied on a single line or element. Second is the Internal CSS used to apply CSS on a single page. Third is the External CSS  used to apply CSS on multiple pages. 

CSS Id Selector 

The ID selector targets the id attribute of an HTML element to select a specific, unique element on a page. It is written with a hash character (#) followed by the ID name. 

CSS Class Selector 

The Class selector is used when you want to change a group of elements. It is used with a period character '.' 

Universal Selector 

The universal selector is used as a wildcard character. It selects all the elements on the Webpages. 

Group Selector 

The grouping selector is used to select all the elements with the same style definitions. It is used to minimize code. 

Positioning in CSS 

CSS helps to position the HTML elements. The position property is used to set position for an element. The element can be positioned using the top, bottom, left and right properties. 

Float Property 

The float property in CSS controls content flow by allowing elements to float to the left or right, enabling text and other inline elements to wrap around them. It can be applied directly in an element's style attribute or within a CSS file for flexible layout management. 

Display property 

Note: The Display property in CSS defines how the components (div, hyperlink, heading, etc) are going to be placed on the web page. It specifies how the element is displayed. 

If you would like to contribute notes or other learning material, please submit them using the button below.
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×