Hit enter after type your search item
img

What is CSS ? A Simple Guide to HTML

/
/
/
170 Views

Sharing is caring!

CSS stands for cascading style sheets. It is a style sheet language used to style a Web page. How HTML will show of the website totally depends on CSS. It can control the layout of multiple web pages all at once.

What does CSS do?

  • You can change your website looks using CSS.
  • You can completely change your website looks with css code
  • Css brings style to your web pages.

CSS Syntax

A css syntax consists of a set of rules. Seletor point to the html element you want to style, The declaration block contain one or declarations seperated by semicolons.For example:

In this example heading tag h1 will be center-aligned, with a red color heading .

Example Explained

  • h1 is a selector in CSS (it points to the HTML element you want to style: <p>).
  • color is a property, and red the property value
  • text-align is a property, center is the property value

What is CSS Selectors

A CSS selector selects the HTML elements(s) you want to style. We can divide CSS selectors into five categories:

  1. CSS Universal Selector
    The CSS universal selector selects all the elements on a web page. For Example

2. CSS Element Selector
CSS Element Selector is also known as a type selector.It selects the HTML element by
name.For Example:

3. CSS ID Selector
CSS ID Selector helps you to styling the content by ID.The selector is define by using #
(hash)
. # sign come before the ID name declared by web developer.In html you can define id
by <div id=”dg”></div>.Here’s an example

4. CSS Classs Selector
CSS Class Selector is one of the most useful selector.It is declared by by using dot and
followed by the name of the class. It is declared in html by <div class=”dg”></div>.
Here’s an example

5. CSS Attribute Selector
The CSS Attribute Selector styles the elecment according to the attribute .In this selector
Attribute value mentioned in square brackets. No spaces in the opening square bracket
by <input type=”text”>.Here’s an example

How To Add CSS

Three Ways to Insert CSS :

  • Extenal CSS
  • Internal CSS
  • Inline CSS

External CSS: By using External css , you can change the style of whole website by changing just one file.It include in HTML file by using <link> element in <head> section of your html File.For example:

Internal CSS: An internal style sheet may be used if one single HTML page has a unique style.The internal style is defined inside the head section by using <style> element. For Example:

Inline CSS: An inline style may be used to apply a unique style for a single element. Add the style attribute to the relevant element. T he style attribute can contain any CSS property. For example:

Leave a Comment

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

This div height required for enabling the sticky sidebar
shares
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :