Zero One Documentation
Theme demo
  • Overview
  • Terms & Guidelines
  • Guide
    • Installation & Setup
      • Local environment
      • Server
      • Default language!
      • Multilanguage website
      • Config options
      • SMTP email options
      • Folder structure
      • htaccess
      • Updating
      • PHP Composer
    • Administration panel
      • Translating panel
    • Site options
      • SEO options
      • Multi-language
    • Theme styling
      • Less/CSS setup
      • Changing Less variables
      • app.less file
      • Customizing elements
      • Helpful classes
    • Page types
      • Page options
    • Blog
      • Comments
      • Article
    • Work (Portfolio)
      • Project page
    • Shop
      • Snipcart
    • Layout Builder
      • Column Options block
      • Subgrid block
      • Card block
      • Text (Writer) block
      • Custom Heading block
      • Custom List block
      • Typed Text block
      • Quote block
      • Button block
      • › 25 more blocks
    • Form Builder (Premium)
    • OLD Page Builder deprecation
    • Tricks
      • Using icons in the content
      • Kirbytext link tag to button
      • Tricks with image classes
      • Adding Google Fonts
      • Custom icons
      • Cookie notice/banner
    • Theme extending
      • Page Transitions (Swup)
      • Contact form extending
      • Self-hosted fonts
      • Adding new templates
      • Adding new Content block (Layout Builder)
    • GDPR
  • More
  • Support
  • Hire us
  • Changelog
  • Credits
  • Affiliate
Powered by GitBook
On this page
  • Image width
  • Image align
  • Margin
  • Remove the left or right margin

Was this helpful?

  1. Guide
  2. Tricks

Tricks with image classes

PreviousKirbytext link tag to buttonNextAdding Google Fonts

Last updated 1 year ago

Was this helpful?

If you are just starting out with Kirby, please first check out what is possible with Kirbytext image tag .

Image width

You can use inbuilt width classes to contain image width. See available classes .

Examples:

# The image will take half of parent container
(image: myawesomepicture.jpg class: uk-width-1-2)

# The image will take quoter of parent container
(image: myawesomepicture.jpg class: uk-width-1-4)

Image align

Also, a very useful class is the align class, see available here .

They are best used when combined with image width classes.

Example when you want to contain image width to half of the parent container width and align it right:

# Half of parent container width, and align right
(image: myawesomepicture.jpg class: uk-width-1-2 uk-align-right)

Example when you want to add an icon or smaller image and align it center:

# Quoter of parent container width, and align center
(image: myawesomepicture.jpg class: uk-width-1-4 uk-align-center)

Margin

# Quoter of parent container width, and align center, with bottom margin
(image: myawesomepicture.jpg class: uk-margin-bottom uk-width-1-4 uk-align-center)

The same classes you can add to the Editor image class option.

Remove the left or right margin

You can make a negative margin (of -40px) to image with the following classes:

# Negative margin left
(image: myawesomepicture.jpg class: uk-container-item-padding-remove-left)

# Negative margin right
(image: myawesomepicture.jpg class: uk-container-item-padding-remove-right)

Your design often needs some control over margin space, and that is when margin classes comes handy .

https://getkirby.com/docs/reference/text/kirbytags/image
https://www.one.thezero.club/guide/theme-styling/helpful-classes#width
https://www.one.thezero.club/guide/theme-styling/helpful-classes#align
https://www.one.thezero.club/guide/theme-styling/helpful-classes#margin