Jump to content

The CSS Grouping Selector


dantepicchioni

Recommended Posts

Dear Colleagues,

Hi.  Why is there no comma between .column and img here
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_image_grid
?

If I sort of combine Examples 3 and 6 from
https://www.w3schools.com/css/css_selectors.asp
then I can create a problem.  The following code only works if the comma is present.
<!DOCTYPE html>
<html>
<head>
<style>
.test, h3 {
  text-align: center;
  color: blue;
}
</style>
</head>
<body>
<h2 class="test">Hello World!</h1>
<h3>Hello World!</h1>
</body>
</html>

Link to comment
Share on other sites

The space indicates the next selector element will be a child of current. The h2 and h3 are siblings not parent of child so it is currect to add coma as they are independent from each other.

Just noticed your html h2/3 closing tags are wrong also, opening and closing should match.

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...