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

CSS: An Overview Forum

View Course » View Exercise

334 points
Bcbc84a050b56b30209fa3dc1d298373?s=140&d=retro
Submitted by
aubrey64
over 3 years ago

I can't figure out what is wrong with my code, help please!

I am having a lot of trouble figuring out what is wrong with my code, and I've been stuck on this one exercise for a full day trying to figure out what the problem is.

I am on exercise 25/26 of "CSS: An Overview". I am on the exercise where you import an image in the HTML editor and set its size and border in the stylesheet.css tab.

This is the instructions for what I need to do:

1. Add an image to your HTML document. Its src attribute can point anywhere! (Check the Hint if you're stuck or need a picture.)
2.On the CSS tab, set your image's height to 100px and width to 300px.
3. On the CSS tab, give your image a border of 1px solid #4682b4.

So I imported the image fine and then I wrote this code for the stylesheet.css tab:

src {
height:100px;
width: 300px;
border: 1px solid #4682b4;
}

I pressed save and submit, and it said I did the code wrong and this message popped up:

"Oops, try again. Did you remember to give your image a 1px solid #4682b4 border?"

After trying to resubmit this code a couple of more times, this tip popped up next to the code that said:

"Using height with border can sometimes make images larger than you expect. Using width with border can sometimes make images larger than you expect."

So after a few more tries, I decided to reformat my code to look like this:

src {
height:100px;
width: 300px;
}
src {
border: 1px solid #4682b4;
}

The warning about image size with height/width disappeared but it still won't accept my code. and this still comes up every time I hit submit:
"Oops, try again. Did you remember to give your image a 1px solid #4682b4 border?"

Can anyone point me in the right direction, and help me figure out what I am doing wrong. Up until now, I've been doing really well with the assignments and practices, but I just cannot figure out what I am doing wrong with this one. Any help is appreciated it! Thanks!


0 votes

permalink

the src is for html to tell where the image is.
in css you use the selector img to style, so:
img {
css code.
}

2893 points
593d545c83696644420003b7_64554016
Submitted by
stetim94
over 3 years ago


0 votes

permalink

It worked! Thank you! I appreciate it!

334 points
Bcbc84a050b56b30209fa3dc1d298373?s=140&d=retro
Submitted by
aubrey64
over 3 years ago

1 Comment

Bc8ff56ca02b2b6443ca2c3574b93e8e?s=140&d=retro JH D over 3 years ago

I am having the same problem and here is my code.

h1 {
font-family:Verdana, sans-serif; color: #576D94;

p {
font-size: 18px; color: #4a4943; font-family: Garamond, serif;
}

img {
height: 100px;
width: 300px;
}

img {
border: 1px solid #4682b4;
h1 {
font-family:Verdana, sans-serif; color: #576D94;

p {
font-size: 18px; color: #4a4943; font-family: Garamond, serif;
}

img {
height: 100px;
width: 300px;
}

img {
border: 1px solid #4682b4;
}

Can you check it against your's and see if mine is the same or different? It would be greatly appreciated. Thank you


0 votes

permalink

@JH
you past your code twice? there are closing accolades missing.
this is what i made of your code:
h1 { font-family:Verdana, sans-serif;
color: #576D94;
}
p {
font-size: 18px;
color: #4a4943;
font-family: Garamond, serif;
}
img {
height: 100px;
width: 300px;
border: 1px solid #4682b4;
}

2893 points
593d545c83696644420003b7_64554016
Submitted by
stetim94
over 3 years ago


0 votes

permalink

Same error for the code:
h1
{
font-family:Verdana,sans-serif;
color:#576D94;
}
p
{
font-family:Garamond,serif;
font-size:18px;
color:#4A4943;
}
img
{
border:1px solid #4682b4;
height:100px;
width:300px;

}

170 points
536722bc282ae315190054e6_32751791
Submitted by
Sachin Agarwal
over 3 years ago

1 Comment

593d545c83696644420003b7_64554016 stetim94 over 3 years ago

your code is fine. could be that is sending wrong data to server, try a couple of different browsers. (easiest fix)


0 votes

permalink

same issues as above?

165 points
822edb05d606d04058168ee912430011?s=140&d=retro
Submitted by
Gabe Gabe
over 2 years ago