Background doesn't display


#1

Hello everyone
I was practicing how to create links between html and css. When I run the page, all the images are displayed in the browser except the first one and I do not understand why? Thank you for reading the email, have a good day.

.main {
text-align: center;
background: url("https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg") no-repeat center center;
background-size: cover;


#2

Hello,
Could you please provide more code?
As well as a link to the exercise?

Now, based on what you posted:

<.main {
text-align: center;
background: url("https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg") no-repeat center center;
background-size: cover;
.>

I'd like to know what <. and .> are?

Thanks!


#3

thank you for your reply Ghostlovescore!

Is this exercise, I put both file in my computer but when I run the html, the first background doesn't display,

(https://www.codecademy.com/courses/learn-html-css/lessons/css-structure-syntax/exercises/css?action=lesson_resume&link_content_target=interstitial_lesson)

<. and .> oh sorry is a mistake!

Thank you


#4

So, if I got this right, this doesn't show when both files (html and CSS) are on your computer, not on Codecademy?

https://s3.amazonaws.com/codecademy-content/projects/move/bg.jpg

I just tried setting this up on my desktop and everything works.

You'll have to make sure that both files are in the same folder, and that the link to the CSS sheet is correct. They don't necessarily have to be in the same folder, but for the sake of this exercise, let's do that.

Put index.html and style.css in the same folder.

Then, in your HTML document, make sure to modify the link to the CSS, like this:

<link href="style.css" type="text/css" rel="stylesheet" />

I just changed /style.css to style.css

That's basically what I did, and everything worked nicely. What puzzles me is that you said "the first background doesn't display". Does that mean the other two do show?


#5

I suppose that there is not problems with files emplacement, because is URL, isn't?
I just would like to know why does it works in the codecademy and it does'nt work in my computer? and why the other urls works and the first one does'nt work?
Yes, exactly!


#6

These are absolute URLs so there shouldn't be any issues, especially when it's working fine on my end.

Are you sure you didn't change anything in the code?


#7

No, I'm not sure, now I'm going to verify and follow your recommendations, thank you ghostlovescore.

I will let you know more late if it works, thanks a lot :grinning:


#8

Thank you Ghostlovescore, it works ! :smile:


#9

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