Background and banner images¶
This guide explains how to integrate layout assets (background images and banner images) into your HTML template. Recall that the base template uses a fixed <div id="your-content" class="your-content"></div> as the main content area, while the <body> keeps a black background (the sign player supplies black as a default, and the base template sets it explicitly).
Images live in the assets folder next to index.html and are referenced with relative
paths (./assets/…); file names should be plain ASCII without spaces (the full packaging
rules are on Getting started with templates).
Size the image for the screen it will fill: a 1920 × 1080 sign needs a 1920 × 1080
background, not a 6000-pixel photo.
Background image¶
Put the image in assets/ and set it on .your-content in styles.css, keeping the base
template's rules:
.your-content {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fff;
z-index: 9999;
pointer-events: none;
background-image: url("./assets/template-background.jpg");
background-repeat: no-repeat;
background-size: cover;
}
background-size: cover scales the image to fill the screen and crops whatever does not
fit the aspect ratio; use contain to show the whole image with bars instead.
Download the background-image example.
Top and bottom banners¶
Make .your-content a column and give it three sections:
<div id="your-content" class="your-content">
<div class="banner top-section">
<img src="./assets/top-banner.jpg" class="banner-image" alt="Top Banner" />
</div>
<div class="middle-section">
<!-- Your content -->
</div>
<div class="banner bottom-section">
<img src="./assets/bottom-banner.jpg" class="banner-image" alt="Bottom Banner" />
</div>
</div>
.your-content {
/* base template rules as above, plus: */
display: flex;
flex-direction: column;
}
.banner {
width: 100%;
position: relative;
overflow: hidden;
}
.banner-image {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.top-section,
.bottom-section {
height: 200px; /* or height: auto; to keep the image's aspect ratio */
}
.middle-section {
flex: 1;
}
A fixed banner height keeps the middle section's size predictable whatever image is
dropped in; height: auto keeps the image's proportions instead and lets the middle
section take what is left.
Related¶
- Getting started with templates
- Fonts
- Embedding video — a video background instead of an image