Can anyone explain ..what is combinators in CSS in detail??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone explain ..what is combinators in CSS in detail???

Css

26th Jul 2020, 2:26 PM
Dheeraj Mittal🇮🇳
4 Answers
+ 2
A CSS selector can contain more than one simple selector. Between the simple selectors, we can include a combinator. There are four different combinators in CSS: -descendant selector (space) -child selector (>) -adjacent sibling selector (+) -general sibling selector (~)
26th Jul 2020, 3:09 PM
JaScript
JaScript - avatar
+ 1
Ja Play but what is the requirement of these combinators
26th Jul 2020, 3:49 PM
Dheeraj Mittal🇮🇳
0
All programming languages will be developed to make somthing easier. Thus for a solution are at the end more ways and possibilities. Depending of your code / webside design can be a way more helpful than other. That means you can for example style your webside with shorter code, which can be again used and is easier to support. Easier to support means you have to change for example only one statement. This is good to know all, what will be allowed in a language. So you can get many ideas from which you could choose, how you want to code your solution.
26th Jul 2020, 5:23 PM
JaScript
JaScript - avatar
0
If you don't want to give id /class to all your html tag in order to keep your code clean . Your will face difficulty in selecting tags ,used multiple time . At that time you can use these combinator relation to select all tags just by adding id to a single element.
28th Jul 2020, 10:29 AM
Divya Mohan
Divya Mohan - avatar