O'Reilly logo

Designing Web & Mobile Graphics: Fundamental Concepts for Web and Interactive Projects by Christopher Schmitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Aligning Images

Image

“Sometimes you want to give up the guitar, you’ll hate the guitar. But, if you stick with it, you’re gonna be rewarded.”

—Jimi Hendrix

Adding an image to a web page is fairly straightforward. While the img element has its own alignment attribute, it’s now better practice to control image alignment through CSS.

You can use CSS to control where the image appears in relation to other elements using relative positioning, floats, and margins. Alternatively, you can control an image’s position with respect to the browser window with absolute positioning and values from the browser edge (such as left and top).

In this chapter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required