Skip to main content

CSS and HTML incoherencesinconsistent when declaring multiple classes

I'm learning CSS "seriously" for the first time, but II've found that the way you deal with multiple CSS classes in CSS and HTML quite incoherentinconsistent.

For example, I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

.style1, .style2, .style3 {
   color: red;
}

Then, if I havewant to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherentconsistent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

CSS and HTML incoherences when declaring multiple classes

I'm learning CSS "seriously" for the first time, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

.style1, .style2, .style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

CSS and HTML inconsistent when declaring multiple classes

I'm learning CSS "seriously" for the first time, but I've found that the way you deal with multiple CSS classes in CSS and HTML quite inconsistent.

For example, I learned that if I want to declare multiple CSS classes with a common style applied to them, I write:

.style1, .style2, .style3 {
   color: red;
}

Then, if I want to declare an HTML tag that has multiple classes applied to it, I write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more consistent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

added 3 characters in body
Source Link
Cesco
  • 123
  • 1
  • 5

I'm learning CSS "seriously" for the first time, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

.style1, .style2, .style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

I'm learning CSS "seriously" for the first time, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

style1, style2, style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

I'm learning CSS "seriously" for the first time, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

.style1, .style2, .style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

deleted 98 characters in body
Source Link
yannis
  • 39.7k
  • 40
  • 185
  • 218

I'm actually learning CSS "seriously" for the first time, and probably this is happening because I'm just a CSS newbie, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

style1, style2, style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. for example, I'm personally thinkingI think that it would make more sense if I could write this to declare a divdiv with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

I'm actually learning CSS "seriously" for the first time, and probably this is happening because I'm just a CSS newbie, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

style1, style2, style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. for example, I'm personally thinking that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

I'm learning CSS "seriously" for the first time, but I found the way you deal with multiple CSS classes in CSS and HTML quite incoherent.

For example I learned that if I want to declare multiple CSS classes with a common style applied to them, I have to write:

style1, style2, style3 {
   color: red;
}

Then, if I have to declare an HTML tag that has multiple classes applied to it, I have to write:

<div class="style1 style2 style3"></div>

And I'm asking why? From my personal point of view it would be more coherent if both could be declared by using a comma to separate each class, or if both could be declared using a space; after all IMHO we're still talking about multiple classes, in both CSS and HTML. I think that it would make more sense if I could write this to declare a div with multiple classes applied:

<div class="style1, style2, style3"></div>

Am I'm missing something important? Could you explain me if there's a valid reason behind these two different syntaxes?

added 75 characters in body
Source Link
Cesco
  • 123
  • 1
  • 5
Loading
deleted 103 characters in body; edited title
Source Link
yannis
  • 39.7k
  • 40
  • 185
  • 218
Loading
Source Link
Cesco
  • 123
  • 1
  • 5
Loading