This forum is now read-only. Please use our new forums at discuss.codecademy.com.

CSS: An Overview Forum

View Course » View Exercise

205 points
Picture
Submitted by
Isaac
over 4 years ago

'div' in css file doesn't work

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

I just put the above code into "stylesheet.css" file, but "Oops, try again.
It looks like your doesn't have the right background-color (#cc0000)!" What's wrong?


3 votes

permalink

div {
background-color:#cc0000;height:100px;width:100px;
}
try this code man

188 points
512e30da1a8d526411007d8c_410386941
Submitted by
VIRAJ
over 4 years ago

3 Comments

Picture The Egyptian Coder over 4 years ago

Hey, I tried yours and it absolutely worked! Thanks dude

512e30da1a8d526411007d8c_410386941 VIRAJ over 4 years ago

wel come

5518153e86f552fd040036b7_402467067 Diana over 2 years ago

It worked. I wish I understood why it worked, when up to this point the course has been showing the properties on separate lines...

Thanks!


0 votes

permalink

I'm getting a problem very similar to yours!

I don't know why...

165 points
51366db7643f4024be00225d_204866670
Submitted by
Bob
over 4 years ago


0 votes

permalink

div {
background-color:#cc0000;height:100px;width:100px;
}
try this code man

188 points
512e30da1a8d526411007d8c_410386941
Submitted by
VIRAJ
over 4 years ago


0 votes

permalink

You must to write a code into index.html... code for html :

code for css:
div {
background-color: #cc0000;
height: 100px;
width: 100px;
}
And it will works, bb :)

809 points
512fca4ece40e39574002f2d_708773368
Submitted by
Павловић Вукашин
over 4 years ago

1 Comment

54dfdf6595e3780241004f80_128477974 Petar Matejic over 2 years ago

are you Serbian


0 votes

permalink

Hello to everybody ! I think I have the solution for this issue.
I have tested the both of the code variations and they both work . But they work with GOOGLE CHROME browser. With Internet Explorer 9 and 10 and Opera 12 both of them running on a Windows 7 64 bits system . I didn't get to try the code with Safari to have another opinion too.
So the solution is : use the two solutions that work just fine , but in Google Chrome browser !

592 points
514099513fb8dc32070062ad_616797259
Submitted by
Bogdan Moisin
over 4 years ago


-1 votes

permalink

Me ha sucedido lo mismo por traducir la pagina.
Recomiendo copiar el codigo de CSS a un bloc de notas y luego volver a pegarlo.

Prueben así.

Saludos

99 points
Picture
Submitted by
Mario Sebastian FreakySeba Martinez
over 4 years ago

2 Comments

53f3764e282ae3da53000455_587160470 Julijana Seketa over 4 years ago

mabye you should speak english.

55ea038a937676dd040001f8_919199260 Jason Li over 3 years ago

Haha


-2 votes

permalink

just leave the html alone just go to the css and paste your code and it will work. it might just be a bug or the person who made this code did it wrong.

1038 points
53f3764e282ae3da53000455_587160470
Submitted by
Julijana Seketa
over 4 years ago


-2 votes

permalink

I have the same problem, tried all the options, nothing works! How to complete the course?

936 points
55d44427e39efec342000151_987290547
Submitted by
Stanislav
over 4 years ago