Coding in the cold

26 March 2017

Tweaking the vertical position of an image

Positioning images/icons alongside text or other elements can be tricky. The following CSS will allow you to slide the image along the vertical axis.

.something img {
    position:relative;
    top:50%;
    transform:translateY(-35%); /* play with this */
}
No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: CSS
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Search

Labels

  • Blogger
  • CodeIgniter
  • CSS
  • Dart-lang
  • Finnish
  • JavaScript
  • jQuery
  • Linux
  • Misc.
  • MySQL
  • PHP
  • Plants
  • Python
  • Raspberry Pi
  • Science
  • Server
  • WordPress

Blog Archive

  • ►  2019 (3)
    • ►  Dec (1)
    • ►  Sept (1)
    • ►  May (1)
  • ►  2018 (5)
    • ►  Oct (3)
    • ►  Sept (1)
    • ►  Feb (1)
  • ▼  2017 (12)
    • ►  Oct (1)
    • ►  Aug (2)
    • ►  Jul (2)
    • ►  Jun (1)
    • ►  May (1)
    • ►  Apr (2)
    • ▼  Mar (1)
      • Tweaking the vertical position of an image
    • ►  Feb (2)
  • ►  2016 (21)
    • ►  Dec (3)
    • ►  Nov (3)
    • ►  Sept (1)
    • ►  May (1)
    • ►  Apr (4)
    • ►  Mar (9)
Privacy Policy. Awesome Inc. theme. Powered by Blogger.