Create the SCSS
Here we will setup the initial styles for the graphic and position it on screen.
Let's begin by taking a look at our current lower-third.1.scss
file in the scss
folder.
Now that we have some SCSS, we can start up the sass
package with the command defined in the Using SCSS portion of this guide. Setting up SCSS is covered in the Development Setup section. Now let's add our first bit of code to our SCSS file.
The first thing we will add to the file is some additional properties to the body declaration.
The font-family
property will set all the fonts for each child element of the body. In this case, our h1
and p
elements. Then the width
and height
properties are set to 100vw
and 100vh
so our body element will always cover the entire screen, regardless of the CasparCG's resolution.
Next we will style the main
element that has the class .lt-style-one
.
Since this is a lower third graphic, we will align the main
element to the flex-end
, or more simply the bottom, of the parent ( body
) element. We want the graphic to be on the bottom portion of the screen, not the absolute bottom so, we will add some padding
and give it a value of 4vh 4vw
. This states that the top and bottom with have a padding of 4vh
while the left and right have a padding of 4vw
. Feel free to play around with the values till you find a distance you like.
Next we will style the container for the graphics's contents. That is the div
with the class of .graphic
.
This div
element will have a grid
display with only 1 column and 2 rows. The overflow
property is hidden
so we can animate the child elements from below this element. Let's style the svg
next.
Our svg
element has a position
of absolute
so it may cover the entire size of the .graphic
container. This is also why we set the .graphic
's position to relative
. Then the z-index
insures it will be above all the other elements.
Then we give the SVG's path
some default values so it appears correctly. Increase the stroke-width
if you want a thicker border.
Finally, we will style the h1
and p
elements. The .subtitle
class is the div
that contains our p
element. Our graphic should now look something like this.
We will be settings the colors for the graphic in the JavaScript file so don't worry if they do not match the style you are looking for. That is all we have to do with our SCSS file, time to write some JavaScript!
Resources
Stroke Line Cap on MDN's website.
Z Index on MDN's website.
Last updated