Difference between div.class and .class


Exercise 4 - Position: Absolute

In the instructions, it says: "In the example above, the .box-bottom div will be moved down and right from the top left corner of the view. If offset properties weren't specified, the top box would be entirely covered by the bottom box." What I don't understand is why the instructions say ".box-bottom div" when the selector is a class. Is ".box-bottom" and "div.box-bottom" the same thing? If not, can you explain how they are different? I've seen several instructions before this one that have done this. Thank You.

The code below was the example they provided.

.box-bottom {
  background-color: DeepSkyBlue;
  position: absolute;
  top: 20px;
  left: 50px;


.box-bottom will select all elements with class .box-bottom where as div.box-bottom only select the divs with class .box-bottom

i suspect the exercise says .box-bottom div is because you only have a div with this class


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.