Skip to main content

Margin & Padding CSS Classes

UIkit offers various margin and padding utilities to style your elements. You can use those classes in our Extensions to style your elements.

Margin

ClassDescription
uk-margin-smallAdds a small margin to the element.
uk-marginAdds a default margin to the element.
uk-margin-largeAdds a large margin to the element.

Dedicated Margin

You can easily add margin to the top, bottom, left or right of an element by using the following classes. simply replace the {x} with small or large to add a margin to the element.

ClassDescription
uk-margin-{x}-bottomAdds a (small / large) bottom margin to the element.
uk-margin-bottomAdds a default bottom margin to the element.
uk-margin-{x}-topAdds a (small / large) top margin to the element.
uk-margin-topAdds a default top margin to the element.
uk-margin-{x}-rightAdds a (small / large) right margin to the element.
uk-margin-rightAdds a default right margin to the element.
uk-margin-{x}-leftAdds a (small / large) left margin to the element.
uk-margin-leftAdds a default left margin to the element.

Padding

ClassDescription
uk-padding-smallAdds a small padding to the element.
uk-paddingAdds a default padding to the element.
uk-padding-largeAdds a large padding to the element.

Dedicated Padding

You can easily add padding to the top, bottom, left or right of an element by using the following classes. simply replace the {x} with top, bottom, left or right. Or use small or large to add a padding to the element.

ClassDescription
uk-padding-{x}-bottomAdds a bottom padding to the element.
uk-padding-{x}-topAdds a top padding to the element.
uk-padding-{x}-rightAdds a right padding to the element.
uk-padding-{x}-leftAdds a left padding to the element.