Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering CSS

You're reading from   Mastering CSS A guided journey through modern CSS

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787281585
Length 522 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Rich Finelli Rich Finelli
Author Profile Icon Rich Finelli
Rich Finelli
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. CSS Foundations 2. Ramping Up FREE CHAPTER 3. Creating a Page Layout with Floats 4. Creating Buttons with Modular, Reusable CSS Classes, and CSS3 5. Creating the Main Navigation and Drop-Down Menu 6. Becoming Responsive 7. Web Fonts 8. Workflow for HiDPI Devices 9. Flexbox, Part 1 10. Flexbox, Part 2 11. Wrapping Up

Shrinking images on the shark movies page

Let's take a look at the images on the movies page. They don't shrink when we resize the browser. They have fixed widths:

I think they should shrink; they're just a little too big in smaller browser sizes. The reason all three images on our movies page don't shrink is because their parent element does not have a width defined. Let's use Ethan Marcotte's formula-target divided by context equals result. We know the context of the area filled by the image, heading 1, paragraph, and learn more button is still 960px wide because it's inside of a wrapper:

So what is the width of the anchor tag that surrounds the image? If we look at our CSS, we have .content-block .figure, where there is no width defined:

.content-block .figure {
float: left;
margin: 30px 3.125%; /* 30/960 */
border: 15px solid #fff;
overflow...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime