Seasonal Savings: 20% off selected memberships for a limited time. Give now

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Replacing the logo and banner graphics with CSS media queries

From: Creating a Responsive Web Design

Video: Replacing the logo and banner graphics with CSS media queries

Now we're going to set some properties and some media queries, so Inside of here, let's scroll down and find header space A.logo. So inside of this rule, let's come in here and add the background size property. Let's hit a few Returns.

Replacing the logo and banner graphics with CSS media queries

Now we're going to set some properties and some media queries, so that we can switch out the logos and the banner graphics. So first, let's switch over to screen layout large, that's CSS in your text editor. Inside of here, let's scroll down and find header space A.logo. Here, we can see, the width is set to 150 and the height is set to 85. And we're using logolarge.png as the background graphic. So inside of this rule, let's come in here and add the background size property. And we're going to set the width, which is the first property, to the same setting that we have up here. So we're going to set width to 150 pixels.

Then a space, 85 pixels for the height. Then a semicolon. going to come in here and copy this. Next we'll come up to the header, where we're specifying banner_large.jpg. Let's come in here. Let's add the background size in here as well. Let's change the width to 980. And we'll set the height to 275. Again, to match the height that's set up here. Now with these in place, let's scroll down to the bottom. Let's hit a few Returns. Let's switch over to our snippet. Let's copy this entire media query.

Switch back to screen_large_layout.css. Let's paste this. And now what we're going to do is, let's come up and grab the header and header logo. Let's copy these entire rules. Let's scroll down and paste them inside of here. Now let's come in here and change only the properties that we need to change for the high pixel density. So let's come in here and get rid of height. Let's change background to background image. Let's get rid of the other properties in that shorthand style. Let's also get rid of background-size and now let's change banner_large to banner_large_2x.

Next for the logo, let's get rid of all these properties as well. And let's just leave background-image. And we'll change logo_large to logo large_2X. Now with these rules in place for the large screen, let's come in here and copy this media query and those two rules. Copy to the clipboard. Save your work inside of layout_large. Let's switch over to screen_layout_medium.css. Down here at the bottom, let's paste in those rules. Let's come down here and change banner_large to banner_medium. Let me copy the name medium.

Let's change logo_large to logo_medium_2x. Then let's scroll up, let's find header space, a logo. After background image. Let's hit Return. Let's add background size. Again we're going to follow the width and height set up here. So, 115 for the width, and 70 pixels for the height. Semicolon. And up here for the header, let's hit Return. Let's add background size. The width is going to be 800 pixels. And the height's going to be 200 pixels.

Now with our medium CSS modified, let's save our work. Let's switch over to screen_layout_small.css. Let's scroll down to the bottom. Hit a few returns. Let's paste in the media query and the CSS rules from the large_screen_size. Let's come down here and change banner_large to banner_small. And change the logo to logo_small. Let's scroll up. Let's find the header. Let's set background size to 500 pixels wide by 85 pixels tall. Then let's come down to the header A .logo. And here we're going to set background size to 105 pixels by 40 pixels.

And then save your file. And now with all of these changes in place, we have a design that'll not only change it's layout based on screen size. But it'll also change the individual graphics based on the pixel density of the device that's looking at your website. Now earlier in the course we talked about the fact that this particular design approach not only changes the layout, but also changes the download size. Supporting high definition graphics means that the download is going to be a lot larger. If we take a look at the new download settings for devices that have high pixel density displays, we'll see that the large screen will go from 180 kilobytes to approximately 365 kilobytes.

Medium will go from 73 to 176 and small screens will go from 32 to 61 kilobytes. Now one thing you'll want to experiment with is for the double-sized graphics, setting the compression settings a little bit lower. Since the graphics are going to be scaled down to match the size of the devices, you might be able to get away with compressing the images a little bit more to get your file sizes down.

Show transcript

This video is part of

Image for Creating a Responsive Web Design
Creating a Responsive Web Design

46 video lessons · 42185 viewers

Chris Converse
Author

 
Expand all | Collapse all
  1. 7m 39s
    1. Previewing the final project
      4m 0s
    2. About the exercise files
      1m 15s
    3. Exploring the software you'll need to complete this course
      49s
    4. Beginning your project
      1m 35s
  2. 3m 45s
    1. What to expect with Design view in Dreamweaver
      2m 1s
    2. Accessing code for HTML and CSS in Dreamweaver
      1m 44s
  3. 9m 19s
    1. Planning your layout
      2m 47s
    2. Adding the main HTML containers
      1m 47s
    3. Adding the promo containers
      31s
    4. Adding links and the copyright
      1m 47s
    5. Adding sample content into the HTML containers
      2m 27s
  4. 8m 37s
    1. Creating and slicing multiple-sized banner images
      5m 53s
    2. Exporting content and template artwork
      2m 44s
  5. 7m 27s
    1. Linking CSS files for all screen sizes
      1m 42s
    2. Linking CSS files based on screen size with media queries
      2m 13s
    3. Enabling Internet Explorer 7 and 8 to understand HTML5
      1m 25s
    4. Setting the viewport scale
      2m 7s
  6. 9m 0s
    1. Adding the background pattern and the page container color
      3m 43s
    2. Styling the headings
      2m 17s
    3. Styling the body text and the links
      1m 15s
    4. Styling the footer
      1m 45s
  7. 9m 49s
    1. Understanding compound rules
      2m 58s
    2. Styling the promo links with a CSS sprite
      2m 48s
    3. Styling the promo text
      1m 26s
    4. Adding the promo images with CSS
      2m 37s
  8. 7m 46s
    1. Adding CSS rules for layout
      2m 8s
    2. Styling the header on large screens
      2m 34s
    3. Styling the article on large screens
      3m 4s
  9. 6m 29s
    1. Styling the navigation links
      2m 1s
    2. Styling the navigation for large screens
      1m 16s
    3. Positioning the navigation for large screens
      1m 37s
    4. Clearing the float for the promos
      1m 35s
  10. 2m 47s
    1. Adding CSS rules with inline media queries
      2m 47s
  11. 6m 0s
    1. Styling the header for medium screens
      2m 32s
    2. Styling the navigation for medium screens
      1m 10s
    3. Styling the promos for medium screens
      2m 18s
  12. 12m 7s
    1. Styling the header for small screens
      2m 27s
    2. Styling the navigation for small screens
      1m 12s
    3. Styling the navigation links for small screens
      4m 13s
    4. Styling the promos for small screens
      2m 57s
    5. Styling the footer for small screens
      1m 18s
  13. 13m 12s
    1. Additional exercise files for this chapter
      1m 4s
    2. Creating double-sized graphics for high-definition screens
      4m 45s
    3. Replacing the promo graphics with CSS media queries
      2m 42s
    4. Replacing the logo and banner graphics with CSS media queries
      4m 41s
  14. 57s
    1. Where to go from here
      57s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating a Responsive Web Design.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.