CSS Syntax: Selectors, Properties, Values
In CSS, you get multiple web page object content selectors choices, where these CSS selectors attributes are used to select HTML webpage website group object or individual web page object text content tag element and apply various types of CSS stylesheet selectors effects and attributes on them. CSS stylesheet attributes modify and make your existing HTML webpage object structure and layout responsive.

So let’s know the existing multiple selectors attributes in CSS.
Basic CSS syntax structure.
type of selector {
object property: object value;
}
CSS selectors.
Selectors are used in CSS to select single and group elements of existing web page or website and apply attributes, with CSS selectors you can style particular HTML web page element.
So let’s understand some common CSS selector attributes
Element css selector – Element CSS selectors are used to select individual element object of any HTML web page.
Element css selector example.
h1 {
font-family: times new roman;
color: red;
}
Class css selector – CSS attributes effect is applied by selecting a particular class element of the current HTML web page. Always remember that class select attributes in CSS start with a point (.).
Class css selector example.
.highlight {
background-color: lime;
}
ID css selector – CSS attributes effect is applied by selecting a particular single ID element of any particular HTML web page. Whereas ID CSS selectors are always started with a hash tag (#) before the ID name.
Id css selector example.
#main-paragraph {
font-family: monotype corsiva;
font-color:red;
font-size: 2em ;
}
Attribute CSS selector – Using CSS, a particular attributes or effect value-based CSS element is selected.
input[type=”number”] {
border: 1px solid blue;
}
Pseudo-class selectors – In CSS, particular elements can be selected based on their conditions and requirements.
p:hover {
text-decoration: underline;
text-decoration: bold;
}
Pseudo-element CSS selectors – Selects a particular element in CSS.
p::first-line {
font-color: red;
font-weight: bold;
}
css properties.
CSS stylesheet properties can be divided into many sections, CSS properties can be applied special CSS attributes and effects to HTML individual element tag object,
So let’s understand many CSS attributes properties better.
Color and background css properties.
- color: red; /* display web page Text red color */
- background-color: yellow; /* display web page Background yellow color */
Text css properties.
- font-size: 2em; /* display 2 em text font Size */
- font-family: times new roman; /* display times new roman font type */
- text-align: right; /* align right order Text */
Box model css properties.
- margin: 20px; /* add 20px Space outside the element */
- padding: 25px; /* add 25px Space inside the element */
- border: 2px solid teal; /* add 2px Border around */
Layout CSS properties.
- display: flex; /* display flex Layout */
- position: absolute; /* set absolute Positioning method */
css properties values.
CSS stylesheet value properties help in selecting different elements. Here CSS value properties can be of many types, and they can be applied in many ways in the web page.
- Keyword values - CSS values represent fixed, some keywords include, auto, none, block, word.
- Units values - CSS values are of many unit types,
- Pixels (px) value – Display previews fixed 20px value.
- Percentage (%) value – Represents the percentage value for the current CSS object, e.g., 70%.
- ems value (em) – Represents the font size for the CSS element object, e.g., 3em.
- rems value (rem) – Represents the font size for the CSS element object, e.g., 1rem font size.
- Color values in CSS – Color attributes applied to CSS element objects in various formats.
In CSS text color example, lime, yellow, brown, red.
- Hexadecimal color example for yellow color, #ffee58).
- RGB color example for orange color, rgb(255, 112, 67)).
- Hsl color example for blue color, HSL 231, 48%, 48%.
A complete example in CSS.
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Css Stylesheet Example</title>
<body>
<style>
h1 {
color: blue;
font-size: 2em;
text-align: center;
margin: 30px;
}
p
{
color:red;
font-size:2em;
font-family: times new roman;
text-align:center;
}
.button {
background-color: green;
color: white;
padding: 20px 30px;
border: solif;
border-radius: 8px;
}
</style>
<h1>This Is A Heading Css Example</h1>
<p>This Is Paragraph Css Example</p>
<form>
<input type=”submit” value=”Submit”>
</form>
</body>
</html>