CSS element Selector (original) (raw)
Last Updated : 29 Aug, 2024
The element selector in CSS is used to select HTML elements that are required to be styled. In a selector declaration, there is the name of the HTML element and the CSS properties which are to be applied to that element is written inside the brackets {}.
**Syntax:
element {
\ CSS property
}
**Example 1: This example shows the element selector in CSS.
html `
element selector<style>
/* h1 element selected here */
h1 {
color: green;
text-align: center;
}
/* h2 element selected here */
h2 {
text-align: center;
}
</style>
GeeksforGeeks
element Selector
`
**Output:
**Example 2: This example shows the element selector in CSS.
html `
element selector