Learn CSS combinators in 4 minutes! ➕

preview_player
Показать описание
#CSS #course #tutorial

CSS combinators descendant child siblings tutorial example explained
Рекомендации по теме
Комментарии
Автор

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bro Code</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

<!--
combinators = explains the relationship
between listed selectors

= descendant
> = child
+ = adjacent sibling
~ = general sibling
-->

<div id="container">
<p>This is #1</p>
<p>This is #2</p>
<div>
<p>This is #3</p>
</div>
</div>

<p>This is #4</p>
<p>This is #5</p>

</body>
</html>

/* style.css */

#container{
border: 2px solid;
}

/* descendant
#container p{
background-color: hsl(60, 100%, 70%);
}
*/

/* child
#container > p{
background-color: hsl(60, 100%, 70%);
}
*/

/* general sibling
#container ~ p{
background-color: hsl(60, 100%, 70%);
}
*/

/* adjacent sibling
#container + p{
background-color: hsl(60, 100%, 70%);
}
*/

BroCodez
Автор

Haven't seen this clear explanation on css combinators anywhere else

abcdabcd
Автор

Straightforward and to the point. Subbed.

Nostalgia_Space
Автор

Thanks for your content man I'm doing the odin project and it's making the material a lot easier to get through

hiphiphorhayy
Автор

he did it again! web dev The coding - Bro Code!

Ella_
Автор

Sir please make video on Artificial intelligence and data science how it works what the actually worker do in it what play important roles in this branch how a robots works what workers do in there job please sir make video about (Artificial intelligence and data science, Artificial intelligence and machine learning and Artificial intelligence and robotics) please sir

akshara_shashikala_achar