Div.answer or .answer or both same thing


Layout 7 Float

It asks to .
"Set the float property of the div.answer element to left."

Now the selector can i just use .answer
or do I have to use div.answer

The class is answer is already in all the divs so cant I just use .answer?
If it was something like a pharagraph for that class then I would use answer.p i think s:
but to target the whole answer div I can jsut write .answer
is that right?

div.answer {
  float: left

.answer {
  border: 1px solid #466995;
  display: inline-block;
  height: 100px;
  margin: 20px;
  padding-top: 40px;
  width: 220px;

.answer:hover {
  background: #C0D6DF;
  color: #FFF;


You should use div.answer to apply float:left;

As you can see ,the .answer class defines what elements with answer class generally look like.But in this case, we only need to change elements with answer class under the div tag.

So use the div.answer to make the general .answer class more specific.


I had a look at the html. so even though all the classes are already div class"answer". we use div.answer to keep it neat and not allow any future things to affect the element? That way div.answer will just be element adjustments right?


Yes.We put more slight changes in div.answer


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