images

Soldiers in our own images


The multi-ethnic reality of India must find expression in its institutions, especially those charged with security. Plus, there are other reasons to broadbase recruitment further, writes Firdaus Ahmed.




images

Images that promote fear


Event-driven media perpetuates the hostility that marks relations between India and Pakistan, says Kalpana Sharma.




images

Images suggest North Korea may be preparing missile launch

Satellite imagery analysis suggests North Korea may be preparing a long-range ballistic missile launch, Japan's Kyodo News reported. The report came as the international community discusses further sanctions against Pyongyang for conducting its fourth nuclear test earlier this month.




images

NASA's Reprocessed Images of Jupiter's Moon, Europa, Show 'Chaos Terrain'

Europa's images usually show a thick, icy shell and dark tints in a lot of areas. The surface is covered with long grooves and etched in a zig-zag manner.




images

Anupama Parameswaran's Facebook Account Hacked, She Lashes Out at Trolls for Morphed Images

Posting the morphed images on Facebook, Premam actress Anupama Parameswaran slammed trolls for committing the cybercrime.




images

Royal Enfield Meteor 350 Fireball Images Leaked — To Be Launched Soon In India

The production-spec Royal Enfield Meteor has been spotted testing earlier on the Indian Roads. Recently, more images of the Royal Enfield Meteor have been leaked online and the motorcycle has been codenamed the Meteor 350 Fireball. The motorcycle is also expected to launch by the end of 2020.




images

Drone images show northern French beach deserted in coronavirus lockdown

Beaches nationwide have been shut for weeks as the government put itself on lockdown in mid-March to curb the spread of the virus, which has to date killed nearly 26,000 nationwide.




images

Climate action planning : a guide to creating low-carbon, resilient communities [Electronic book] / Michael R. Boswell, Adrienne I. Greve, and Tammy L. Seale ; with contributions by Eli Krispi ; images by Dina Perkins.

Washington, DC : Island Press, [2019]




images

Analysis of Images, Social Networks and Texts [Electronic book] : 8th International Conference, AIST 2019, Kazan, Russia, July 17-19, 2019, Revised Selected Papers / Wil M. P. van der Aalst... [et al.] (eds.).

Cham : Springer, 2019.




images

Built-in Browser Support for Responsive Images

Take advantage of the new element and new features of in your next responsive website.




images

Media/society : industries, images, and audiences / David Croteau, Virginia Commonwealth University, William Hoynes, Vassar College

Croteau, David, author




images

7 Hello 2019 Images to Post on Social Media

We have brought together some of our favorite hello 2019 images in order to honor the coming year, which will bring with it plenty of joy.

The beginning of a new year brings with it plenty of hopes and dreams that could completely change the course of your life for the better if you discipline yourself, put the work in and try your hardest to make those changes happen. In the long run, keeping your New Years resolutions could be the thing that helps put everything into place for you.

complete article




images

Happy Mother’s Day 2020: Wishes, images, quotes, status, messages, cards, and photos




images

Failed images: photography and its counter-practices / Ernst van Alphen

Rotch Library - TR183.A47 2018




images

After silence: a history of AIDS through its images / Avram Finkelstein

Hayden Library - NX180.A36 F56 2018




images

Introducing science through images: cases of visual popularization / Maria E. Gigante

Rotch Library - N72.S3 G54 2018




images

To begin at the beginning / Javier Marías ; translated from the Spanish by Margaret Jull Costa ; images: Wifredo Lam

Hayden Library - PQ6663.A7218 Z46 2016




images

Images des corps, corps des images au cinéma / sous la direction de Jérôme Game ; avec les contributions de Vincent Amiel [and others]

Online Resource




images

Shimmering images: trans cinema, embodiment, and the aesthetics of change / Eliza Steinbock

Dewey Library - PN1995.9.S47 S74 2019




images

Enduring images: a future history of new left cinema / Morgan Adamson

Hayden Library - PN1995.9.S6 A33 2018




images

Exploring the Geographic Images Collection

One of the best, if at times maddening parts of any reference librarian or archivist’s job is solving a mystery. What appears at first to be just another query turns into a bona fide challenge. My colleague and I had one such query recently, involving a photo of a clapboard house on East 83rd Street that...

The post Exploring the Geographic Images Collection appeared first on New-York Historical Society.




images

Tourist destination images and local culture : using the example of the United Arab Emirates / Verena Schwaighofer ; foreword by Prof. Dr. Sc. Othmar M. Lehner

Schwaighofer, Verena, author




images

The tourism imaginary and pilgrimages to the edges of the world / edited by Nieves Herrero and Sharon R. Roseman




images

Engraving Images

Copperplate engraving is an exacting process that created precise images for an age before sharing pictures was simple. Journeyman engraver Lynn Zelesnikar tells us how it’s done.




images

An anthropology of images : picture, medium, body / Hans Belting ; translated by Thomas Dunlap

Belting, Hans, author




images

How to Display Mode-Specific Images

Now that we have most of the basics of HTML and CSS in the browser, we’ve begun implementing new features that I would consider “quality of life” improvements, many of which have been inspired by mobile. One great example is the CSS prefers-color-scheme media query, which allows developers to cater their design to system theme […]

The post How to Display Mode-Specific Images appeared first on David Walsh Blog.




images

The illuminated theatre : studies on the suffering of images / Joe Kelleher

Kelleher, Joe, author




images

WIRED Lab - The NASA Illustrator Who Hides Sci-Fi Easter Eggs in Official Images of Space

Visualization specialist at NASA’s Jet Propulsion Laboratory, Robert Hurt, tells us how he balances scientific accuracy and creativity when creating stunning pieces of art that double as realistic depictions of space.




images

Check Out Beautiful Sonar Images of the Seafloor Near Hawaii

Scientists have mapped the seafloor near Hawaii with huge blasts of sonar. It's beautiful AND educational!




images

How to serve Images on Web

Because even if you think you're doing right, many others are not. Here the catch: just use <img srcset> attribute to improve the experience in your own site, don't do the same mistake others are doing! Read the full post about it




images

Engendering interaction with images / Audrey G. Bennett

Bennett, Audrey, author




images

What philosophy wants from images / D.N. Rodowick

Rodowick, David Norman, author




images

Fear of Hell: Images of Damnation and Salvation in Early Modern Europe


 Read More...




images

Unveiling galaxies: the role of images in astronomical discovery / Jean-René Roy, formerly Gemini Observatory, La Serena, Chile

Hayden Library - QB121.R697 2018




images

Neena, Soni redefine friendship goals with images

Actress Neena Gupta, Soni Razdan and producer Anu Ranjan have redefined friendship goals in a "then and now" photograph.




images

Pro Processing for Images and Computer Vision with OpenCV: Solutions for Media Artists and Creative Coders / by Bryan Wc Chung

Online Resource




images

Computer Aided Intervention and Diagnostics in Clinical and Medical Images

Online Resource




images

Principles of medical imaging for engineers: from signals to images / Michael Chappell

Online Resource




images

Dionysos in classical Athens: an understanding through images / by Cornelia Isler-Kerényi

Online Resource




images

The Praiseworthy One: the Prophet Muhammad in Islamic texts and images / Christiane Gruber

Rotch Library - BP75.G78 2018




images

Champions of illusion: the science behind mind-boggling images and mystifying brain puzzles / Susana Martinez-Conde and Stephen Macknik

Hayden Library - QP495.M37 2017




images

Chimpanzee retirement gains momentum, and x-ray ‘ghost images’ could cut radiation doses

Two of the world’s most famous research chimpanzees have finally retired. Hercules and Leo arrived at a chimp sanctuary in Georgia last week. Sarah Crespi checks in with Online News Editor David Grimm on the increasing momentum for research chimp retirement since the primates were labeled endangered species in 2015. Sarah also interviews freelancer Sophia Chen about her piece on x-ray ghost imaging—a technique that may lead to safer medical imaging done with cheap, single-pixel cameras. David Malakoff joins Sarah to talk about the big boost in U.S. science funding signed into law over the weekend. Finally, Jen Golbeck interviews author Stephanie Elizabeth Mohr on her book First in Fly: Drosophila Research and Biological Discovery for our monthly books segment. This week’s episode was edited by Podigy. Listen to previous podcasts. [Image: Crystal Alba/Project Chimps; Music: Jeffrey Cook]




images

Flexible Captioned Slanted Images

Eric Meyer gift wraps the most awkwardly shaped of boxes using nothing but CSS, HTML and a little curl of ribbon. No matter how well you plan and how much paper you have at your disposal, sometimes you just need to slant the gift to the side.


We have a lot of new layout tools at our disposal these days—flexbox is finally stable and interoperable, and Grid very much the same, with both technologies having well over 90% support coverage. In that light, we might think there’s no place for old tricks like negative margins, but I recently discovered otherwise.

Over at An Event Apart, we’ve been updating some of our landing pages, and our designer thought it would be interesting to have slanted images of speakers at the tops of pages. The end result looks like this.

The interesting part is the images. I wanted to set up a structure like the following, so that it will be easy to change speakers from time to time while preserving accessible content structures:

<div id="page-top">
  <ul class="monoliths">
    <li>
      <a href="https://aneventapart.com/speakers/rachel-andrew"> 
        <img src="/img/rachel-andrew.jpg" alt=""> 
        <div> 
          <strong>Rachel Andrew</strong> CSS Grid 
        </div> 
      </a>
    </li>
    <li>
      <a href="https://aneventapart.com/speakers/derek-featherstone"> 
        <img src="/img/derek-featherstone.jpg" alt=""> 
        <div> 
          <strong>Derek Featherstone</strong> Accessibility 
        </div> 
      </a>
    </li>
    <li>
      …
    </li>
    <li>
      …
    </li>
  </ul>
</div>

The id value for the div is straightforward enough, and I called the ul element monoliths because it reminded me of the memorial monoliths at the entrance to EPCOT in Florida. I’m also taking advantage of the now-ubiquitous ability to wrap multiple elements, including block elements, in a hyperlink. That way I can shove the image and text structures in there, and make the entire image and text below it one link.

Structure is easy, though. Can we make that layout fully responsive? I wondered. Yes we can. Here’s the target layout, stripped of the navbar and promo copy.

So let’s start from the beginning. The div gets some color and text styling, and the monoliths list is set to flex. The images are in a single line, after all, and I want them to be flexible for responsive reasons, so flexbox is 100% the right tool for this particular job.

#page-top { 
  background: #000; 
  color: #FFF; 
  line-height: 1; 
} 
#page-top .monoliths { 
  display: flex; 
  padding-bottom: 1em; 
  overflow: hidden; 
}

I also figured, let’s give the images a simple basis for sizing, and set up the hyperlink while we’re at it.

#page-top .monoliths li { 
  width: 25%; 
} 
#page-top .monoliths a { 
  color: inherit; 
  text-decoration: inherit; 
  display: block; 
  padding: 1px; 
}

So now the list items are 25% wide—I can say that because I know there will be four of them—and the links pick up the foreground color from their parent element. They’re also set to generate a block box.

At this point, I could concentrate on the images. They need to be as wide as their parent element, but no wider, and also match height. While I was at it, I figured I’d create a little bit of space above and below the captioning text, and make the strong elements containing speakers’ names generate a block box.

#page-top .monoliths img { 
  display: block; 
  height: 33rem; 
  width: 100%; 
} 
#page-top .monoliths div { 
  padding: 0.5em 0; 
} 
#page-top .monoliths strong { 
  display: block; 
  font-weight: 900; 
}

It looks like the speakers were all cast into the Phantom Zone or something, so that needs to be fixed. I can’t physically crop the images to be the “correct” size, because there is no correct size: this needs to work across all screen widths. So rather than try to swap carefully-sized images in and out at various breakpoints, or complicate the structure with a wrapper element set to suppress overflow of resized images, I turned to object-fit.

#page-top .monoliths img { 
  display: block; 
  height: 33rem; 
  width: 100%; 
  object-fit: cover; 
  object-position: 50% 20%; 
}

If you’ve never used object-fit, it’s a bit like background-size. You can use it to resize image content within the image’s element box without creating distortions. Here, I set the fit sizing to cover, which means all of the img element’s element box will be covered by image content. In this case, it’s like zooming in on the image content. I also set a zooming origin with object-position, figuring that 50% across and 20% down would be in the vicinity of a speaker’s face, given the way pictures of people are usually taken.

This is fairly presentable as-is—a little basic, perhaps, but it would be fine to layer the navbar and promo copy back over it with Grid or whatever, and call it a day. But it’s too square and boxy. We must go further!

To make that happen, I’m going to take out the third and fourth images temporarily, so we can see more clearly how the next part works. That will leave us with Rachel and Derek.

The idea here is to clip the images to be slanted, and then pull them close to each other so they have just a little space between them. The first part is managed with clip-path, but we don’t want to pull the images together unless their shapes are being clipped. So we set up a feature query.

@supports (clip-path: polygon(0 0)) or (-webkit-clip-path: polygon(0 0)) { 
  #page-top .monoliths li { 
    width: 37.5%; 
  } 
}

I decided to test for both the un-prefixed and WebKit-prefixed versions of clip-path because Safari still requires the prefix, and I couldn’t think of a good reason to penalize Safari’s users for the slowness of its standards advancement. Then I made the images wider, taking them from 25% to 37.5%, which makes them half again as wide.

Thanks to object fitting, the images don’t distort when I change their parent’s width; they just get wider and scale up the contents to fit. And now, it is time for clipping!

@supports (clip-path: polygon(0 0)) or (-webkit-clip-path: polygon(0 0)) { 
  #page-top .monoliths li { 
    width: 37.5%; 
    -webkit-clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
    clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
  } 
}

Each coordinate pair in the polygon() is like the position pairs in background-position or object-position: the horizontal distance first, followed by the vertical distance. So the first point in the polygon is 25% 0, which is 25% of the way across the element box, and no distance down, so right at the top edge. 100% 0 is the top right corner. 75% 100% is on the bottom edge, three-quarters of the way across the element, and 0 100% is the bottom left corner. That creates a polygon that’s a strip three-quarters the full width of the element box, and runs from bottom left to top right.

Now we just have to pull them together, and this is where old tricks come back into play: all we need is a negative right margin to bring them closer together.

#page-top .monoliths li { 
  width: 37.5%; 
  margin-right: -7.5%; 
  -webkit-clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
  clip-path: polygon(25% 0, 100% 0, 75% 100%, 0 100%); 
}

The separation between them is a little wider than we were originally aiming for, but let’s see what happens when we add the other two images back in and let flexbox do its resizing magic.

Notice how the slants actually change shape as the screen gets narrower or wider. This is because they’re still three-quarters the width of the image element’s box, but the width of that box is changing as the screen width changes. That means at narrow widths, the slant is much steeper, whereas at wide widths, the slant is more shallow. But since the clipping path’s coordinates were all set with percentage distances, they all stay parallel to each other while being completely responsive to changes in screen size. An absolute measure like pixels would have failed.

But how did the images get closer together just by adding in two more? Because the list items’ basic sizing added up to more than 100%, and they’re all set to flex-shrink: 1. No, you didn’t miss a line in the CSS: 1 is the default value for flex-shrink. Flex items will shrink by default, which after all is what we should expect from a flexible element. If you want to know how much they shrunk, and why, here’s what Firefox’s flex inspector reports.

When there were only two list items, there was space enough for both to be at their base size, with no shrinkage. Once we went to four list items, there wasn’t enough space, so they all shrank down. At that point, having a negative right margin of -7.5% was just right to pull them together to act as a unit.

So, now they’re all nicely nestled together, and fully responsive! The captions need a little work, though. Notice how they’re clipped off a bit on the left edge, and can be very much clipped off on the right side at narrower screen widths? This happens because the li elements are being clipped, and that clipping applies to all their contents, images and text alike. And we can’t use overflow to alter this: clipped is clipped, not overflowed.

Fortunately, all we really need to do is push the text over a small amount. Inside the feature query, I added:

#page-top .monoliths div { 
  padding-left: 2%;
  padding-right: 26%; 
}

This shifts the text just a bit rightward, enough to clear the clip path. On the right side, I padded the div boxes so their contents wouldn’t fall outside the clipped area and appear to slide under the next caption. We could also use margins here, but I didn’t for reasons I’ll make clear at the end.

At the last minute, I decided to make the text at least appear to follow the slants of the images. For that, I just needed to shift the first line over a bit, which I did with a bit more padding.

#page-top .monoliths strong { 
  padding-left: 1%; 
}

That’s all to the good, but you may have noticed the captions still overlap at really narrow screen widths. There are a lot of options here, from stacking the images atop one another to reverting to normal flow, but I decided to just hide the captions if things got too narrow. It reduces clutter without sacrificing too much in the way of content, and by leaving them still technically visible, they seem to remain accessible.

@media (max-width: 35rem) { 
  #page-top .monoliths div { 
    opacity: 0.01 
  } 
}

And that, as they say, is that! Fully responsive slanted images with text, in an accessible markup structure. I dig it.

I did fiddle around with the separations a bit, and found that a nice thin separator occurred around margin-right: -8%, whereas beefier ones could be found above -7%. And if you crank the negative margin value to something beyond -8%, you’ll make the images overlap entirely, no visible separation—which can be a useful effect in its own right.

I promised to say why I used padding for the caption text div rather than margins. Here’s why.

#page-top .monoliths div { 
  padding-left: 3%; 
  padding-right: 26%; 
  border-top: 2px solid transparent; 
  background: linear-gradient(100deg,hsl(292deg,50%,50%) 50%, transparent 85%); 
  background-clip: padding-box; 
}

It required a wee bit more padding on the left to look decent, and an alteration to the background clipping box in order to keep the purple from filling the transparent border area, but the end result is pretty nifty, if I do say so myself. Alternatively, we could drop the background gradient on the captions and put one in the background, with a result like this.

I have no doubt this technique could be extended, made more powerful, and generally improved upon. I really wished for subgrid support in Chrome, so that I could put everything on a grid without having to tear the markup structure apart, and there are doubtless even more interesting clipping paths and layout patterns to try out.

I hope these few ideas spark some much better ideas in you, and that you’ll share them with us!


About the author

Eric A. Meyer (@meyerweb) has been a burger flipper, a college webmaster, an early blogger, one of the original CSS Samurai, a member of the CSS Working Group, a consultant and trainer, and a Standards Evangelist for Netscape. Among other things, Eric co-wrote Design For Real Life with Sara Wachter-Boettcher for A Book Apart and CSS: The Definitive Guide with Estelle Weyl for O’Reilly, created the first official W3C test suite, assisted in the creation of microformats, and co-founded An Event Apart with Jeffrey Zeldman. Eric lives with his family in Cleveland, Ohio, which is a much nicer city than you’ve probably heard. He enjoys a good meal whenever he can and considers almost every form of music to be worthwhile.

More articles by Eric




images

CSS drop-shadows without images

Drop-shadows are easy enough to create using pseudo-elements. It’s a nice and robust way to progressively enhance a design. This post is a summary of the technique and some of the possible appearances.

Demo: CSS drop-shadows without images

Known support: Firefox 3.5+, Chrome 5+, Safari 5+, Opera 10.6+, IE 9+

I’ll be looking mainly at a few details involved in making this effect more robust. Divya Manian covered the basic principle in her article Drop Shadows with CSS3 and Matt Hamm recently shared his Pure CSS3 box-shadow page curl effect.

After a bit of back-and-forth on Twitter with Simurai, and proposing a couple of additions to Divya’s and Matt’s demos using jsbin, I felt like documenting and explaining the parts that make up this technique.

The basic technique

There is no need for extra markup, the effect can be applied to a single element. A couple of pseudo-elements are generated from an element and then pushed behind it.

.drop-shadow {
  position: relative;
  width: 90%;
}

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
}

The pseudo-elements need to be positioned and given explicit or implicit dimensions.

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 15px;
  left: 10px;
  width: 50%;
  height: 20%;
}

The next step is to add a CSS3 box-shadow and apply CSS3 transforms. Different types of drop-shadow can be produced by varying these values and the types of transforms applied.

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 15px;
  left: 10px;
  width: 50%;
  height: 20%;
  box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
  transform: rotate(-3deg);
}

One of the pseudo-elements then needs to be positioned on the other side of the element and rotated in the opposite direction. This is easily done by overriding only the properties that need to differ.

.drop-shadow:after{
  right: 10px;
  left: auto;
  transform: rotate(3deg);
 }

The final core code is as shown below. There is just one more addition – max-width – to prevent the drop-shadow from extending too far below very wide elements.

.drop-shadow {
  position: relative;
  width: 90%;
}

.drop-shadow:before,
.drop-shadow:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 15px;
  left: 10px;
  width: 50%;
  height: 20%;
  max-width: 300px;
  box-shadow :0 15px 10px rgba(0, 0, 0, 0.7);
  transform: rotate(-3deg);
}

.drop-shadow:after{
  right: 10px;
  left: auto;
  transform: rotate(3deg);
}

No Firefox 3.0 problems this time

Some pseudo-element hacks require a work-around to avoid looking broken in Firefox 3.0 because that browser does not support the positioning of pseudo-elements. This usually involves implicitly setting their dimensions using offsets.

However, as Divya Manian pointed out to me, in this case we’re only using box-shadow – which Firefox 3.0 doesn’t support – and Firefox 3.0 will ignore the position:absolute declaration for the pseudo-elements. This leaves them with the default display:inline style. As a result, there is no problem explicitly setting the pseudo-element width and height because it won’t be applied to the pseudo-elements in Firefox 3.0.

Further enhancements

From this base there are plenty of ways to tweak the effect by applying skew to the pseudo-elements and modifying the styles of the element itself. A great example of this was shared by Simurai. By adding a border-radius to the element you can give the appearance of page curl.

.drop-shadow {
  border-radius: 0 0 120px 120px / 0 0 6px 6px;
}

I’ve put together a little demo page with a few of drop-shadow effects, including those that build on the work of Divya Manian and Matt Hamm.

If you’ve got your own improvements, please send them to me on Twitter.




images

Responsive images using CSS3

Future CSS implementations should allow for some form of responsive images via CSS alone. This is an early idea for how that might be done. However, a significant drawback is that it would not prevent both “mobile optimised” and larger size images from being requested at larger screen resolutions.

Note that the CSS presented here is not supported in any browsers at the time of writing.

This method relies on the use of @media queries, CSS3 generated content, and the CSS3 extension to the attr() function.

The principles are basically the same as those underpinning Filament Group’s work on Responsive Images. The source image is “mobile optimised” and the urls of larger size images are included using HTML data-* attributes.

<img src="image.jpg"
     data-src-600px="image-600px.jpg"
     data-src-800px="image-800px.jpg"
     alt="">

Using CSS @media queries you can target devices above certain widths. Within each media query block, images with larger alternatives can be targeted using an attribute selector.

CSS3 generated content allows you to replace the content of any element using the content property. At the moment, only Opera 10+ supports it. In CSS 2.1, the content property is limited to use with the :before and :after pseudo-elements.

By combining the content property with the CSS3 extension to attr(), you will be able to specify that an attribute’s value is interpreted as the URL part of a url() expression. In this case, it means you will be able to replace an image’s content with the image found at the destination URL stored in a custom HTML data-* attribute.

@media (min-device-width:600px) {
  img[data-src-600px] {
    content: attr(data-src-600px, url);
  }
}

@media (min-device-width:800px) {
  img[data-src-800px] {
    content: attr(data-src-800px, url);
  }
}

Fork the Gist

Issues

Unfortunately, there are a number of issues with this technique.

  1. It doesn’t prevent multiple assets being downloaded at larger screen widths because network activity kicks in before CSS is applied. That means, for example, that desktop environments would make 2 HTTP requests for an image and have to load more assets than if they had been served only the larger image in the source.
  2. It makes the assumption that wider screens are tied to better internet connections.
  3. It forces authors to create and maintain multiple image sizes for each image.
  4. At present, using the context menu (or drag and drop) to copy the image will result in the source file being copied and not the replacement image.
  5. It doesn’t account for devices with different pixel densities.




images

Flexible CSS cover images

I recently included the option to add a large cover image, like the one above, to my posts. The source image is cropped, and below specific maximum dimensions it’s displayed at a predetermined aspect ratio. This post describes the implementation.

Known support: Chrome, Firefox, Safari, Opera, IE 9+

Features

The way that the cover image scales, and changes aspect ratio, is illustrated in the following diagram.

The cover image component must:

  • render at a fixed aspect ratio, unless specific maximum dimensions are exceeded;
  • support different aspect ratios;
  • support max-height and max-width;
  • support different background images;
  • display the image to either fill, or be contained within the component;
  • center the image.

Aspect ratio

The aspect ratio of an empty, block-level element can be controlled by setting a percentage value for its padding-bottom or padding-top. Given a declaration of padding-bottom:50% (and no explicit height), the rendered height of the element will be 50% of its width.

.CoverImage {
  padding-bottom: 50%;
}

Changing that padding value will change the aspect ratio. For example, padding of 25% results in an aspect ratio of 4:1, padding of 33.333% results in an aspect ratio of 3:1, etc.

Maximum dimensions

The problem with using this aspect ratio hack is that if the element has a max-height declared, it will not be respected. To get around this, the hack can be applied to a pseudo-element instead.

.CoverImage:before {
  content: "";
  display: block;
  padding-bottom: 50%;
}

Now the main element can take a max-height. It should also clip the pseudo-element overflow.

.CoverImage {
  display: block;
  max-height: 300px;
  max-width: 1000px;
  overflow: hidden;
}

.CoverImage:before {
  content: "";
  display: block;
  padding-bottom: 50%;
}

This aspect ratio pattern is provided by the FlexEmbed component for SUITCSS. That component is primarily for responsive video embeds, but it’s flexible enough to be useful whenever you need an element rendered at a predetermined aspect ratio. It comes with modifiers for 2:1, 3:1, 16:9, and 4:3 aspect ratios. The cover image component can extend the FlexEmbed component.

<div class="CoverImage FlexEmbed FlexEmbed--2by1"></div>

Background image

The cover image is applied as a background image that is sized to cover the entire area of the element. This makes sure the image is clipped to fit the aspect ratio of the element.

.CoverImage {
  ...
  background-repeat: no-repeat;
  background-size: cover;
}

If you want different cover images for different instances of the component, they can be applied via the style attribute.

<div class="..." style="background-image: url(cover.jpg)"></div>

The image can be fully centered by using background positioning and block centering. This makes sure that the image is centered in the element, and that the element is centered within its parent (when it reaches the max-width value).

.CoverImage {
  ...
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: cover;
  margin: 0 auto;
}

Final result

If you depend on the FlexEmbed module, the amount of additional code required is minimal. (See the demo for all the code, including the FlexEmbed dependency.)

/**
 * Requires: suitcss/flex-embed
 */

.CoverImage {
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: cover;
  margin: 0 auto;
  max-height: 300px;
  max-width: 1000px;
}
<div class="CoverImage FlexEmbed FlexEmbed--3by1"
     style="background-image:url(cover.jpg)">
</div>

You can add further customizations, such as setting the accompanying background color, or providing a means to switch between the cover and contain keywords for background-size.




images

Responsive Images the Simple Way

The responsive images spec is fantastic and covers a lot of use cases, but most of the time you’ll only need one: resolution switching using the `srcset` and `sizes` attributes.




images

Gravity's century: from Einstein's eclipse to images of black holes / Ron Cowen

Hayden Library - QC173.6.C36 2019




images

Fear of Hell: Images of Damnation and Salvation in Early Modern Europe


 Read More...




images

Mycorrhizas [electronic resource] : anatomy and cell biology images / R. Larry Peterson ... [et al.]