-1

I am applying styles to my html elements from a style sheet.

I want to know what is the difference between

//No comma seperation
.elementSpace tbody tr td input label{ 
    margin-left: 0.5em;
}

and

//comma seperation between input and label
.elementSpace tbody tr td input, label{
    margin-left: 0.5em;
}
Vadim Kotov
  • 7,766
  • 8
  • 46
  • 61
overflow
  • 65
  • 1
  • 7
  • first one styles a label in your input, which is not valid html and the second one styles the input in .elementSpace and EVERY label – Dirk Feb 22 '18 at 09:09
  • See the link https://www.thoughtco.com/comma-in-css-selectors-3467052 – Athul Nath Feb 22 '18 at 09:10

2 Answers2

0

First one is applying margin-left to label that is inside input, where input is inside td, where td is inside tr, where tr is inside tbody, and tbody is inside element with class elementSpace

While second one is applying maring-left to input where input is inside td, where td is inside tr, where tr is inside tbody, and tbody is inside element with class elementSpace, and it is applying to all labels.

There is no easy way to explain if new to coding.

noitse
  • 1,000
  • 9
  • 25
0

In the first section margin-left are applied to the label elements that are inside .elementSpace tbody tr td input elements.

In the second section styles are applied in two elements that are separated by commas:

  1. input elements that are inside .elementSpace tbody tr td,
  2. label elements that are anywhere on the body of the page
Bedri Allkja
  • 1
  • 1
  • 2