Sharp Tutorial
CSS Selectors

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

HTML

  • HTML Home
  • Introduction
  • HTML Element
  • Commonly used tags
  • Hyperlinks
  • Images in HTML
  • Div in HTML
  • Html Forms
  • Html Tables
  • Miscellaneous Topics

CSS

  • Introduction to CSS
  • How to apply CSS
  • CSS Selectors
  • Border in CSS
  • Text Formatting in CSS
  • Font Properties
  • Margin in CSS
  • CSS in List
  • CSS in Link
  • CSS Animation
  • CSS Effects
  • CSS Pagination
  • CSS Media Query

Java Script

  • Java Script Home
  • Introduction to Java Script
  • Variable in Java Script
  • Operators in Java Script
  • If-Else in Java Script
  • Loops in Java Script
  • Array in Java Script
  • Function in Java Script
  • Objects in Java Script
  • Java Script DOM

CSS Selectors

CSS selector is how to apply the CSS on web pages elements based on their names , id or class.

  • Element Selector-:Using this selector we apply the css on the basis on tag name.
    e.g: following css apply the alignment and color attribute on <p> tag elements.
p { text-align: center; color: red; }
  • ID selector -:To apply the css by using the ID selector we give the name of ID with (#) hash.
    e.g. In the following code the css is being applied on the id name from html page.
#myDiv{
width:300px;
height:400px;
background-color:red;
}
<div id="myDiv">Hi</div>
  • Class Selector-:To apply the css by using Class selector we give the name of the class with (.) dot.
    In following exmaple the element with class name my class will apply the following css properties.
myClass{
text-align: center;
color: red;
}
<div class="myClass">Hello</div>
  • CSS grouping Selector-:CSS may also be applied on multiple elements with their names etc.
h1, h2, h3{
text-align: center;
color: red;
}

The above css is applied on all of the tag elements either h1 or h2 or h3.

  • Universal Selector-:Universal selector * is applied to implement the css on all elements of the web page.
{
color:blue;
}

Above code applies the font color blue for all page html elements.

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial