19/26 Background color, height, and width


#1

What's the problem here? :confounded:

/*Add your CSS below!*/

div { 
    
    background-color: #cc0000;
    
    height: 100px;
    
    color: 100px;
    
}

Codecademy returns:

Oops, try again. It looks like your <div> isn't 100px wide; it appears to be 1350px wide. (If you're getting a weird number, try resetting your zoom with Ctrl-0 or Cmd-0.)

I've checked again & again. Can someone help me? :anguished: Thanks. :slight_smile:


#2

Hello :slight_smile:

You should simply define width of the element:

div {
    background-color: #cc0000;
    height: 100px;
    width: 100px; 
}

#3

when you tried to set your width to 100px:

color: 100px;

you use the color property instead of the width property.

@factoradic, i agree, except that 100px; is not a valid value for the color property


#4

It's weird that I could pass with this:

div { 
    
    background-color: #CC0000;
    
    height: 100px;
    
    color: 100px;
    
    width: 100px
    
}

as well as this:

div { 
    
    background-color: #CC0000;
    
    height: 100px;
    
    width: 100px
    
}

Why is that so?


#5

well, in both cases you did what is asked by the exercise. The exercise allows you (sometimes) to add more, it is great that you have some degree of freedom to experiment within the exercises.


#6

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