Skip to main content
CSS-Tricks
  • Articles
  • Notes
  • Links
  • Guides
  • Almanac
  • Picks
  • Shuffle
Search

Articles Tagged
vertical-align

7 Articles
{
,

}
Image
Direct link to the article Deep dive CSS: font metrics, line-height and vertical-align
line-height typography vertical-align

Deep dive CSS: font metrics, line-height and vertical-align

Vincent De Oliveira has written an epic post that details pretty much everything you might ever want to know about the line-height and vertical-align properties. If you’ve ever had trouble aligning things next to text or wondered why two fonts …

Image
Robin Rendle on Feb 24, 2017
Image
Direct link to the article Centering in CSS Guide
centering layout vertical-align

Centering in CSS Guide

Centering things in CSS is the poster child of CSS complaining. Why does it have to be so hard? They jeer. I think the issue isn’t that it’s difficult to do, but in that there so many different ways of …

Image
Chris Coyier on Sep 2, 2014 Updated on Aug 12, 2024
Image
Direct link to the article Centering in the Unknown
centering pseudo elements vertical-align

Centering in the Unknown

When it comes to centering things in web design, the more information you have about the element being centered and its parent element, the easier it is. So what if you don’t know anything? It’s still kinda doable.…

Image
Chris Coyier on Oct 29, 2011 Updated on Mar 29, 2019
Image
Direct link to the article vertical-align
vertical-align

vertical-align

The vertical-align property in CSS controls how elements set next to each other on a line are lined up.

img {
  vertical-align: middle;
}

In order for this to work, the elements need to be set along a baseline. As …

Image
Sara Cope on Sep 6, 2011 Updated on Feb 11, 2025
Image
Direct link to the article Absolute Center (Vertical & Horizontal) an Image
centering vertical-align

Absolute Center (Vertical & Horizontal) an Image

CSS background-image Technique:

html { 
   width:100%; 
   height:100%; 
   background:url(logo.png) center center no-repeat;
}

CSS + Inline Image Technique:

img {
   position: absolute;
   top: 50%;
   left: 50%;
   width: 500px;
   height: 500px;
   margin-top: -250px; /* Half the height */
   margin-left: -250px; /* Half 
…
Image
Chris Coyier on Sep 4, 2009 Updated on Feb 24, 2017
Image
Direct link to the article Vertically Center Multi-Lined Text
speech bubble typography vertical-align

Vertically Center Multi-Lined Text

If you only have a single word or a single line of text, there is a clever way to vertically center it in a block with CSS. You set the line-height of that text to be equal to the height…

Image
Chris Coyier on May 13, 2009 Updated on Feb 24, 2017
Image
Direct link to the article What is Vertical Align?
vertical-align

What is Vertical Align?

CSS has a property called vertical align. It can be a bit confusing when you first learn about it, so I thought we could help explain what it is for and some use cases.

The basic usage is like …

Image
Chris Coyier on Apr 20, 2009 Updated on Jan 7, 2020

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • About DO
  • Cloudways
  • Legal stuff
  • Get free credit!
CSS-Tricks
  • Contact
  • Write for CSS-Tricks!
  • Advertise with us
Social
  • RSS Feeds
  • CodePen
  • Mastodon
  • Bluesky
Back to Top
Advertisement