8. Change background image


#1

I see the link explaining how to set the image, but WHERE do I have to do that in the code?


#2

Hi @webrockstar91526,

Please post a link to the exercise you're on so I can take a look. It'll probably be inside app/assets/stylesheets/CONTROLLER-NAME.scss :slight_smile:


#3

Hi zystvan, here's the link
https://www.codecademy.com/courses/learn-rails/projects/learn-rails_broadway?user_id=57a37280dd1ede35eb000132

I found the file you said and added there:
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;

but I get an error message when trying to acces the page, do you know what's wrong?


#4

@webrockstar91526 Thanks! So in app/assets/stylesheets/pages.css.scss you'll want to set the background image's URL to https://s3.amazonaws.com/codecademy-content/projects/broadway/bg.jpg. Your code should look like this after doing that:

.jumbotron {
  background: url('http://s3.amazonaws.com/codecademy-content/projects/broadway/bg.jpg') no-repeat center center;
  background-size: cover;
}

:slight_smile:


#5

Ok. Did so already, but I'm getting an error when trying to access the page.

Sass::SyntaxError in Pages#home

Do you know what's going on?

Also, everytime I reenter the lesson and try to run the server the terminal requests me to install the bundle again. Is this normal?

Thanks man


#6

@webrockstar91526

Sass::SyntaxError in Pages#home

Could you post your code for app/views/pages/home.html.erb and app/assets/stylesheets/pages.css.scss? I'll see if I can spot the problem.

Also, everytime I reenter the lesson and try to run the server the terminal requests me to install the bundle again. Is this normal?

Since Codecademy does stuff their own way, I do think that's normal on Codecademy (unfortunately). Once you're doing Rails development on your own, outside of Codecademy, you won't have to run bundle install after the first time unless you want to update your Gems, though :slight_smile:


#7

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