Block / Content Block
Content blocks designed (mostly) to add extra formatting and required spacing for text content:
Block
To add content block element just add <div>
with block
class:
<div class="block">
<!-- block content -->
</div>
To add extra highlighting to block element we need additional block-strong
class
<div class="block block-strong">
<!-- block content -->
</div>
To remove hairlines around strong block we need additional no-hairlines
class
<div class="block block-strong no-hairlines">
<!-- block content -->
</div>
To make block inset we need additional inset
class
<div class="block block-strong inset">
<!-- inset block content -->
</div>
To make block inset only on large screens we need to use medium-inset
(>= 768px) class instead:
<div class="block block-strong medium-inset">
<!-- inset block content -->
</div>
For full set of such responsive classes check Grid docs. They are xsmall-inset
, small-inset
, medium-inset
, large-inset
, xlarge-inset
.
Block Title
To add block title before Block or List View we need element with block-title
class:
<div class="block-title">Here comes block title</div>
<div class="block">
<!-- block content -->
</div>
<div class="block-title">Here comes the list</div>
<div class="list">
<!-- list content -->
</div>
<!-- Medium size Block Title -->
<div class="block-title block-title-medium">Medium Title</div>
<div class="block">
<!-- block content -->
</div>
<!-- Large size Block Title -->
<div class="block-title block-title-large">Large Title</div>
<div class="block">
<!-- block content -->
</div>
Block Header / Footer
If we need and extra heading and footer texts we can use Block Header element. It can be used both inside and outside of block elements (Block, List View)
<!-- Inside of block -->
<div class="block">
<!-- Block header -->
<div class="block-header">Block Header</div>
...
<!-- Block footer -->
<div class="block-footer">Block Footer</div>
</div>
<!-- Outside of block -->
<div class="block-header">Block Header</div>
<div class="block">
...
</div>
<div class="block-footer">Block Footer</div>
<!-- After Block Title -->
<div class="block-title">Block Title Here</div>
<div class="block-header">Block Header</div>
<div class="block">
...
</div>
<div class="block-footer">Block Footer</div>
CSS Variables
Below is the list of related CSS variables (CSS custom properties).
:root {
--f7-block-padding-horizontal: 16px;
--f7-block-padding-vertical: 16px;
--f7-block-font-size: inherit;
--f7-block-text-color: inherit;
--f7-block-header-margin: 10px;
--f7-block-footer-margin: 10px;
--f7-block-header-font-size: 14px;
--f7-block-footer-font-size: 14px;
--f7-block-title-text-transform: none;
--f7-block-title-white-space: nowrap;
--f7-block-title-medium-text-transform: none;
--f7-block-title-large-text-transform: none;
--f7-block-inset-side-margin: 16px;
--f7-block-title-medium-text-color: #000;
--f7-block-title-large-text-color: #000;
--f7-block-strong-bg-color: #fff;
}
:root .theme-dark,
:root.theme-dark {
--f7-block-title-text-color: #fff;
--f7-block-strong-border-color: rgba(255, 255, 255, 0.15);
--f7-block-title-medium-text-color: #fff;
--f7-block-title-large-text-color: #fff;
--f7-block-strong-bg-color: #1c1c1d;
}
.ios {
--f7-block-margin-vertical: 35px;
--f7-block-strong-border-color: rgba(0, 0, 0, 0.22);
--f7-block-title-text-color: #000;
--f7-block-title-font-size: 16px;
--f7-block-title-font-weight: 600;
--f7-block-title-line-height: 20px;
--f7-block-title-margin-bottom: 10px;
--f7-block-title-medium-font-size: 22px;
--f7-block-title-medium-font-weight: bold;
--f7-block-title-medium-line-height: 1.4;
--f7-block-title-large-font-size: 30px;
--f7-block-title-large-font-weight: bold;
--f7-block-title-large-line-height: 1.3;
--f7-block-inset-border-radius: 8px;
--f7-block-strong-text-color: #000;
--f7-block-header-text-color: rgba(0, 0, 0, 0.45);
--f7-block-footer-text-color: rgba(0, 0, 0, 0.45);
}
.ios .theme-dark,
.ios.theme-dark {
--f7-block-header-text-color: rgba(255, 255, 255, 0.55);
--f7-block-footer-text-color: rgba(255, 255, 255, 0.55);
--f7-block-strong-text-color: #fff;
}
.md {
--f7-block-margin-vertical: 32px;
--f7-block-strong-text-color: inherit;
--f7-block-strong-border-color: rgba(0, 0, 0, 0.12);
--f7-block-title-font-size: inherit;
--f7-block-title-text-color: rgba(0, 0, 0, 0.54);
--f7-block-title-font-weight: 500;
--f7-block-title-line-height: 16px;
--f7-block-title-margin-bottom: 16px;
--f7-block-title-medium-font-size: 24px;
--f7-block-title-medium-font-weight: 500;
--f7-block-title-medium-line-height: 1.3;
--f7-block-title-large-font-size: 34px;
--f7-block-title-large-font-weight: 500;
--f7-block-title-large-line-height: 1.2;
--f7-block-inset-border-radius: 4px;
--f7-block-header-text-color: rgba(0, 0, 0, 0.54);
--f7-block-footer-text-color: rgba(0, 0, 0, 0.54);
}
.md .theme-dark,
.md.theme-dark {
--f7-block-header-text-color: rgba(255, 255, 255, 0.54);
--f7-block-footer-text-color: rgba(255, 255, 255, 0.54);
}
.aurora {
--f7-block-margin-vertical: 15px;
--f7-block-strong-border-color: rgba(0, 0, 0, 0.12);
--f7-block-title-font-size: inherit;
--f7-block-title-text-color: rgba(0, 0, 0, 0.7);
--f7-block-title-font-weight: 600;
--f7-block-title-line-height: 1.5;
--f7-block-title-margin-bottom: 5px;
--f7-block-title-medium-font-size: 20px;
--f7-block-title-medium-font-weight: 600;
--f7-block-title-medium-line-height: 1.4;
--f7-block-title-large-font-size: 28px;
--f7-block-title-large-font-weight: bold;
--f7-block-title-large-line-height: 1.3;
--f7-block-inset-border-radius: 4px;
--f7-block-strong-text-color: inherit;
--f7-block-header-text-color: rgba(0, 0, 0, 0.6);
--f7-block-footer-text-color: rgba(0, 0, 0, 0.6);
}
.aurora .theme-dark,
.aurora.theme-dark {
--f7-block-header-text-color: rgba(255, 255, 255, 0.54);
--f7-block-footer-text-color: rgba(255, 255, 255, 0.54);
--f7-block-strong-text-color: #fff;
}
Examples
<p>This paragraph is outside of content block. Not cool, but useful for any custom elements with custom styling.</p>
<!-- Content block -->
<div class="block">
<p>Here comes paragraph within content block. Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<!-- Additional "block-strong" class for extra highlighting -->
<div class="block block-strong">
<p>Here comes another text block with additional "<b>block-strong</b>" class. Praesent nec imperdiet diam. Maecenas vel lectus porttitor, consectetur magna nec, viverra sem. Aliquam sed risus dolor. Morbi tincidunt ut libero id sodales. Integer blandit varius nisi quis consectetur. </p>
</div>
<!-- Block Title -->
<div class="block-title">Block title</div>
<div class="block">
<p>Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-title">Another ultra long content block title</div>
<div class="block block-strong">
<p>Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-title">Inset</div>
<!-- Inset content block -->
<div class="block block-strong inset">
<p>Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-title">Tablet Inset</div>
<!-- This block will be inset only on tablets (large screens) -->
<div class="block block-strong medium-inset">
<p>Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-title">With Header & Footer</div>
<div class="block">
<!-- Block header -->
<div class="block-header">Block Header</div>
<p>Here comes paragraph within content block. Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
<!-- Block footer -->
<div class="block-footer">Block Footer</div>
</div>
<div class="block-header">Block Header</div>
<div class="block">
<p>Here comes paragraph within content block. Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-footer">Block Footer</div>
<div class="block block-strong">
<div class="block-header">Block Header</div>
<p>Here comes paragraph within content block. Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
<div class="block-footer">Block Footer</div>
</div>
<div class="block-header">Block Header</div>
<div class="block block-strong">
<p>Here comes paragraph within content block. Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-footer">Block Footer</div>
<div class="block-title block-title-large">Block Title Large</div>
<div class="block block-strong">
<p>Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>
<div class="block-title block-title-medium">Block Title Medium</div>
<div class="block block-strong">
<p>Donec et nulla auctor massa pharetra adipiscing ut sit amet sem. Suspendisse molestie velit vitae mattis tincidunt. Ut sit amet quam mollis, vulputate turpis vel, sagittis felis. </p>
</div>