Pictures
Component
We have three ways to use pictures in web:
- Insert
<img>with src or<picture>with source - Using
style="background-image:url('<path>')" - Embedding base64 encode picture to code
I'm using first and seconds ways often, that's why I made component to simplify my work.
Insert a picture
You can insert a picture to your code with class .__wo-pict, for example:
Example
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Markup
<p>…
<img class="__wo-pict" src="…" alt="Picture">
…</p>
This picture separate text. Also you can use .--float-left or .--float-right modificators to not separate text. This is .--float-left version:
Example
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Markup
<p>…
<img class="__wo-pict --float-left" src="…" alt="Picture">
…</p>
Picture with caption
Sometimes you need to insert picture with caption, for this you have container .__wo-pict-box.
Example
Markup
<div class="__wo-pict-box">
<img src="…" alt="Picture with caption">
<span>Picture with caption</span>
</div>
Initially picture and caption is on center, but you can use modificators to align picture .--align-left or .--align-right.
Example
Markup
<div class="__wo-pict-box --align-left">
<img src="…" alt="Picture with caption aligned left">
<span>Picture with caption aligned left</span>
</div>
<div class="__wo-pict-box --align-right">
<img src="…" alt="Picture with caption aligned right">
<span>Picture with caption aligned right</span>
</div>
Also you can use color modificators, by default is a color --wo-gray. You can use color modificators .--primary and others. Like this:
.--primary
.--success
.--info
.--danger
.--warning
<div class="__wo-pict-box">
<img src="…" alt="Picture with caption default">
<span>Picture with caption default</span>
</div>
<div class="__wo-pict-box --primary">
<img src="…" alt="Picture with caption .--primary">
<span>Picture with caption <code>.--primary</code></span>
</div>
<div class="__wo-pict-box --success">
<img src="…" alt="Picture with caption .--success">
<span>Picture with caption <code>.--success</code></span>
</div>
<div class="__wo-pict-box --info">
<img src="…" alt="Picture with caption .--info">
<span>Picture with caption <code>.--info</code></span>
</div>
<div class="__wo-pict-box --danger">
<img src="…" alt="Picture with caption .--danger">
<span>Picture with caption <code>.--danger</code></span>
</div>
<div class="__wo-pict-box --warning">
<img src="…" alt="Picture with caption .--warning">
<span>Picture with caption <code>.--warning</code></span>
</div>
Of cource you can use <picture> instead <img> for all of this cases.
Plain .__wo-pict element
<picture class="__wo-pict">
<source srcset="…" media="(max-width:768px)" />
<source srcset="…" media="(min-width:769px)" />
<img src="…" />
</picture>
Picture with caption with <picture> element
<picture> with caption
<div class="__wo-pict-box">
<picture>
<source srcset="…" media="(max-width:768px)" />
<source srcset="…" media="(min-width:769px)" />
<img src="…" />
</picture>
<span><code><picture></code> with caption</span>
</div>
Picture as background
Sometimes you need section with picture as background, this is the way you can made it:
<div class="__wo-pict-bg" style="background-image:url('…');"></div>
You can use .--fixed to fix background position.
<div class="__wo-pict-bg --fixed" style="background-image:url('…');"></div>
Also you can use .--faded for faded background and place content inside of this block.
Header for picture
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
<div class="__wo-pict-bg --fixed --faded" style="background-image:url('…');">
<h2>Header for picture</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<button class="__wo-btn --inverted --outline --border-circle">CTA Button</button>
</div>
Border radius
You can use .--border-rounded or .--border-circle for modify picture border radius.
.--border-rounded
.--border-circle
Sizes
If it necessary, you can set the size for the picture directly and in advance for .__wo-pict or .__wo-pict-box.
Example
Markup
<div class="__wo-pict-box --wo-size-xs">
<img src="…" alt="Size XS">
<span>Size XS</span>
</div>
<div class="__wo-pict-box --wo-size-s">
<img src="…" alt="Size S">
<span>Size S</span>
</div>
<div class="__wo-pict-box --wo-size-m">
<img src="…" alt="Size M">
<span>Size M</span>
</div>
<div class="__wo-pict-box --wo-size-l">
<img src="…" alt="Size L">
<span>Size L</span>
</div>
<div class="__wo-pict-box --wo-size-xl">
<img src="…" alt="Size XL">
<span>Size XL</span>
</div>
User picture
For making author block for blog, or userpic block for your interface
Default size
<div class="__wo-user">
<div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">John Doe</a>
</div>
Container .__wo_user is inline-flex, you can use it in text.
Also you can modify it with .--wo-size-*, like this:
<div class="__wo-user --wo-size-xs"><div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">XS size</a></div>
<div class="__wo-user --wo-size-s"><div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">S size</a></div>
<div class="__wo-user"><div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">Default size</a></div>
<div class="__wo-user --wo-size-m"><div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">M size</a></div>
<div class="__wo-user --wo-size-l"><div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">L size</a></div>
<div class="__wo-user --wo-size-xl"><div class="__wo-pict" style="background-image:url('…');"></div><a href="javascript:;">XL size</a></div>
Pictures from unsplash.com and xsgames.co