Loading...
Loading...
By continuing to use the platform, you accept the terms of the Privacy Policy and the use of cookies.
CSS selectors are tools for selecting and styling HTML elements. They allow you to apply styles to specific elements based on their tags, classes, IDs, and other characteristics.
E > F) — selects only direct descendants.div > p selects paragraphs that are direct children of div.E + F) — selects the element immediately following the specified one.h1 + p selects the first paragraph immediately after an h1 heading.E ~ F) — selects all elements following the specified one.h1 ~ p selects all paragraphs following an h1./* Tag selector */
p {
color: red;
}
/* Class selector */
.button {
background-color: blue;
}
/* ID selector */
#header {
font-size: 24px;
}
/* Attribute selector */
input[type="text"] {
border: 1px solid #ccc;
}