Create an image overlay, which comes in different styles.
Add the .uk-overlay
class to an element following an image to create the overlay panel. To create a position context, add the .uk-inline
class from the Utility component to a container element around both. Finally, add one of the .uk-position-*
classes from the Position component to align the overlay.
<div class="uk-inline">
<img src="" width="" height="" alt="">
<div class="uk-overlay uk-position-bottom"></div>
</div>
Note Add the .uk-light
or .uk-dark
class, so that elements will be optimized for better visibility on dark or light images.
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay uk-light uk-position-bottom">
<p>Default Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
By default, the overlay has padding, but no additional styling. Add one of these modifier classes to add a background color to the overlay.
For a simple background color, add the .uk-overlay-default
class.
<div class="uk-child-width-1-2@m" uk-grid>
<div>
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay uk-overlay-default uk-position-bottom">
<p>Default Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
</div>
<div>
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay-default uk-position-cover"></div>
<div class="uk-overlay uk-position-bottom uk-dark">
<p>Default Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
</div>
</div>
For a prominent background color, add the .uk-overlay-primary
class.
<div class="uk-child-width-1-2@m" uk-grid>
<div>
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay uk-overlay-primary uk-position-bottom">
<p>Default Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
</div>
<div>
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay-primary uk-position-cover"></div>
<div class="uk-overlay uk-position-bottom uk-light">
<p>Default Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
</div>
</div>
To display an overlay icon, add the uk-overlay-icon
attribute to a <span>
element inside the overlay.
<div class="uk-position-center">
<span uk-overlay-icon></span>
</div>
<div class="uk-child-width-1-2@m" uk-grid>
<div>
<div class="uk-inline uk-light">
<img src="images/dark.jpg" width="1800" height="1200" alt="">
<div class="uk-position-center">
<span uk-overlay-icon></span>
</div>
</div>
</div>
<div>
<div class="uk-inline uk-dark">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay-default uk-position-cover">
<div class="uk-position-center">
<span uk-overlay-icon></span>
</div>
</div>
</div>
</div>
</div>
Add one of the .uk-position-*
classes from the Position component to align the overlay.
<div class="uk-overlay uk-position-top"></div>
<div class="uk-child-width-1-2@m" uk-grid>
<div>
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay uk-overlay-default uk-position-top">
<p>Top</p>
</div>
</div>
</div>
<div>
<div class="uk-inline">
<img src="images/photo.jpg" width="1800" height="1200" alt="">
<div class="uk-overlay uk-overlay-default uk-position-center">
<p>Center</p>
</div>
</div>
</div>
</div>