CSS Styling Images


Discover how to use CSS to change the appearance of images.

Rounded Images

You can make pictures look round using the border-radius property.

Paris
Paris

Thumbnail Images

You can employ the border property to make small preview pictures.

Thumbnail Image:

Paris

Thumbnail Image as Link:


Responsive Images

Images that are responsive will change their size to fit the screen they are displayed on.

Change the size of your web browser window to observe the outcome:

Bridge

If you'd like an image to become smaller when needed but not become larger than its original size, use the following code in your HTML:

Tip: Learn more about making websites that work well on different devices in our CSS Responsive Web Design Tutorial.


Center an Image

To place an image in the middle, adjust its position by setting the left and right margins to "auto" and ensure it is a block element in your HTML code.

Benches

Polaroid Images / Cards

Bridge

Cinque Terre

Bridge

Northern Lights


Transparent Image

You can set the Opacity property to a number between 0.0 and 1.0. A lower number makes something more see-through.

fox

opacity 0.2

fox

opacity 0.5

Fox

opacity 1
(default)


Image Text

How to place text on an image:


Image Filters

The CSS property called filter can be used to add special visual effects, such as blurring and changing colors, to an element on a web page.

Important Note: The filter property doesn't work in Internet Explorer or Edge 12.


Image Hover Overlay

Make a hover effect that adds an overlay.


Flip an Image

Hover your mouse pointer over the picture:

Paris

Responsive Image Gallery

You can use CSS to make picture collections. This sample uses media queries to arrange the pictures differently based on the size of the screen. Try changing the size of your web browser window to see what happens.

Fox
Add a description of the image here
Fox
Add a description of the image here
fox
Add a description of the image here
Fox
Add a description of the image here

Hint: Learn more about making websites look good on different devices by checking out our CSS Responsive Web Design Tutorial.