- You can use CSS pseudo selectors to change specific HTML elements.
- In this course, you'll build a balance sheet using pseudo selectors. You'll learn how to change the style of an element when you hover over it with your mouse, and trigger other events on your webpage.
Step 1
Set up your HTML with theDOCTYPE
,html
indicating this document is in English,head
, andbody
elements.
Give yourhead
element the appropriatemeta
elements for thecharset
andviewport
, atitle
element with an appropriate title, and alink
element for your stylesheet.
#index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Balance Sheet</title>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
</body>
</html>
Step 2
Within yourbody
element, nest asection
element within amain
element.
#index.html
<body>
<main>
<section>
</section>
</main>
</body>
Step 3
Within yoursection
element, add anh1
element with a nestedspan
element.
#index.html
<section>
<h1>
<span>
</span>
</h1>
</section>
Step 4
Screen readers announce HTML elements based on the document flow. We will eventually want the balance sheet to have a heading of "Balance Sheet" and a subheading of "AcmeWidgetCorp". However, this order does not make sense if announced by a screen reader.
Give your existingspan
theclass
attribute set toflex
, and add twospan
elements within it. Give the first the textAcmeWidgetCorp
. Give the second the textBalance Sheet
. You will use CSS to reverse the order of the text on the page, but the HTML order will make more sense for a screen reader.
#index.html
<span class="flex">
<span>AcmeWidgetCorp</span>
<span>Balance Sheet</span>
</span>
Step 5
Below yourh1
element, create adiv
element. Give it anid
attribute set toyears
. You want this particular element to be hidden from screen readers, so give it thearia-hidden
attribute set totrue
.
#index.html
<div id="years" aria-hidden="true">
</div>
Step 6
Within yourdiv
element, add threespan
elements. Give each of them aclass
attribute set toyear
, and add the following text (in order):2019
,2020
, and2021
.
#index.html
<div id="years" aria-hidden="true">
<span class="year">2019</span>
<span class="year">2020</span>
<span class="year">2021</span>
</div>
Step 7
Below your existingdiv
element, add a newdiv
element with aclass
set totable-wrap
. This will be the container for your tables.
Within that, add threetable
elements. You will be using CSS to style these into a single table, but using separate tables will help screen readers understand the document flow.
#index.html
<div class="table-wrap">
<table></table>
<table></table>
<table></table>
</div>
Step 8
HTML tables use thecaption
element to describe what the table is about. Thecaption
element should always be the first child of atable
, but can be positioned with thecaption-side
CSS property.
Add acaption
element to your firsttable
, and give it the textAssets
.
#index.html
<table>
<caption>Assets</caption>
</table>
Step 9
Thethead
andtbody
elements are used to indicate which portion of your table is the header, and which portion contains the primary data or content.
Add athead
andtbody
to your firsttable
, below thecaption
element.
#index.html
<table>
<caption>Assets</caption>
<thead></thead>
<tbody></tbody>
</table>
Step 10
Thetr
element is used to indicate a table row. Add atr
element within yourthead
element. In your newtr
element, add atd
element, followed by threeth
elements.
Thetd
element indicates a data cell, while theth
element indicates a header cell.
#index.html
<thead>
<tr>
<td></td>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
Step 11
Within each of your newth
elements, nest aspan
element with theclass
set tosr-only year
. Give them the following text (in order):2019
,2020
, and2021
.
Give your thirdth
element theclass
attribute set tocurrent
.
Leave thetd
element empty. This element exists only to ensure your table has a four-column layout and associate the headers with the correct columns.
#index.html
<thead>
<tr>
<td></td>
<th><span class="sr-only year">2019</span></th>
<th><span class="sr-only year">2020</span></th>
<th class="current"><span class="sr-only year">2021</span></th>
</tr>
</thead>
Step 12
Within yourtbody
element, add fourtr
elements. Give the first three aclass
attribute set todata
, and the fourth aclass
attribute set tototal
.
#index.html
<tbody>
<tr class="data"></tr>
<tr class="data"></tr>
<tr class="data"></tr>
<tr class="total"></tr>
</tbody>
Step 13
In your firsttr
, add ath
element with the textCash This is the cash we currently have on hand.
. Wrap all of that text exceptCash
in aspan
element with theclass
set todescription
.
Following that, add threetd
elements with the following text (in order):$25
,$30
,$28
. Give the thirdtd
element aclass
attribute set tocurrent
.
#index.html
<tr class="data">
<th>Cash <span class="description">This is the cash we currently have on hand.</span></th>
<td>$25</td>
<td>$30</td>
<td class="current">$28</td>
</tr>
Step 14
In your secondtr
element, add ath
element with the textChecking Our primary transactional account.
. Wrap that text, except forChecking
, in aspan
element with theclass
attribute set todescription
.
Following that, add threetd
elements with the following text (in order):$54
,$56
,$53
. Give the thirdtd
element aclass
attribute set tocurrent
.
#index.html
<tr class="data">
<th>Checking <span class="description">Our primary transactional account.</span></th>
<td>$54</td>
<td>$56</td>
<td class="current">$53</td>
</tr>
Step 15
In your thirdtr
element, add ath
element with the textSavings Funds set aside for emergencies.
. Wrap that text, except forSavings
, in aspan
element with theclass
attribute set todescription
.
Following that, add threetd
elements with the following text (in order):$500
,$650
,$728
. Give the thirdtd
element aclass
attribute set tocurrent
.
#index.html
<tr class="data">
<th>Savings <span class="description">Funds set aside for emergencies.</span></th>
<td>$500</td>
<td>$650</td>
<td class="current">$728</td>
</tr>
Step 16
In your fourthtr
element, add ath
element with the textTotal Assets
. Wrap the textAssets
in aspan
element with theclass
attribute set tosr-only
.
Following that, add threetd
elements with the following text (in order):$579
,$736
,$809
. Give the thirdtd
element aclass
attribute set tocurrent
.
#index.html
<tr class="total">
<th>Total <span class="sr-only">Assets</span></th>
<td><span class="sr-only year">$579</span></td>
<td><span class="sr-only year">$736</span></td>
<td class="current"><span class="sr-only year">$809</span></td>
</tr>
Step 17
Time to move on to your second table. Start by giving it acaption
element set toLiabilities
. Then add yourthead
andtbody
.
#index.html
<table>
<caption>Liabilities</caption>
<thead></thead>
<tbody></tbody>
</table>
Step 18
Within yourthead
, add atr
. Inside that, add atd
and threeth
elements.
#index.html
<table>
<caption>Liabilities</caption>
<thead>
<tr>
<td></td>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Step 19
Give eachth
element aspan
element with the class set tosr-only
and the following text, in order:2019
,2020
, and2021
.
#index.html
<table>
<caption>Liabilities</caption>
<thead>
<tr>
<td></td>
<th><span class="sr-only">2019</span></th>
<th><span class="sr-only">2020</span></th>
<th><span class="sr-only">2021</span></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Step 20
Within thetbody
element, add fourtr
elements. Give the first three theclass
attribute set todata
, and the fourth theclass
attribute set tototal
.
#index.html
<table>
<caption>Liabilities</caption>
<thead>
<tr>
<td></td>
<th><span class="sr-only">2019</span></th>
<th><span class="sr-only">2020</span></th>
<th><span class="sr-only">2021</span></th>
</tr>
</thead>
<tbody>
<tr class="data"></tr>
<tr class="data"></tr>
<tr class="data"></tr>
<tr class="total"></tr>
</tbody>
</table>
Step 21
Within the firsttr
, add ath
element with the textLoans The outstanding balance on our startup loan.
. Wrap that text, except forLoans
, within aspan
element with theclass
set todescription
.
Add threetd
elements below that, and give them the following text, in order:$500
,$250
, and$0
. Give the thirdtd
element aclass
set tocurrent
.
#index.html
<tr class="data">
<th>Loans <span class="description">The outstanding balance on our startup loan.</span></th>
<td >$500</td>
<td>$250</td>
<td class="current">$0</td>
</tr>
<tr class="data">
</tr>
<tr class="data">
</tr>
<tr class="total">
</tr>
Step 22
Within the secondtr
, add ath
element with the textExpenses Annual anticipated expenses, such as payroll.
. Wrap that text, except forExpenses
, within aspan
element with theclass
set todescription
.
Add threetd
elements below that, and give them the following text, in order:$200
,$300
, and$400
. Give the thirdtd
element aclass
set tocurrent
.
#index.html
<tr class="data">
<th>Loans <span class="description">The outstanding balance on our startup loan.</span></th>
<td>$500</td>
<td>$250</td>
<td class="current">$0</td>
</tr>
<tr class="data">
<th>Expenses <span class="description">Annual anticipated expenses, such as payroll.</span></th>
<td>$200</td>
<td>$300</td>
<td class="current">$400</td>
</tr>
<tr class="data">
</tr>
<tr class="total">
</tr>
Step 23
Within the thirdtr
, add ath
element with the textCredit The outstanding balance on our credit card.
. Wrap that text, except forCredit
, within aspan
element with theclass
set todescription
.
Add threetd
elements below that, and give them the following text, in order:$50
,$50
, and$75
. Give the thirdtd
element aclass
set tocurrent
.
#index.html
<tr class="data">
<th>Loans <span class="description">The outstanding balance on our startup loan.</span></th>
<td>$500</td>
<td>$250</td>
<td class="current">$0</td>
</tr>
<tr class="data">
<th>Expenses <span class="description">Annual anticipated expenses, such as payroll.</span></th>
<td>$200</td>
<td>$300</td>
<td class="current">$400</td>
</tr>
<tr class="data">
<th>Credit <span class="description">The outstanding balance on our credit card.</span></th>
<td>$50</td>
<td>$50</td>
<td class="current">$75</td>
</tr>
<tr class="total">
</tr>
Step 24
In your fourthtr
element, add ath
element with the textTotal Liabilities
. Wrap the textLiabilities
in aspan
element with theclass
attribute set tosr-only
.
Following that, add threetd
elements with the following text (in order):$750
,$600
,$475
. Give the thirdtd
element aclass
attribute set tocurrent
.
#index.html
<tr class="data">
<th>Loans <span class="description">The outstanding balance on our startup loan.</span></th>
<td>$500</td>
<td>$250</td>
<td class="current">$0</td>
</tr>
<tr class="data">
<th>Expenses <span class="description">Annual anticipated expenses, such as payroll.</span></th>
<td>$200</td>
<td>$300</td>
<td class="current">$400</td>
</tr>
<tr class="data">
<th>Credit <span class="description">The outstanding balance on our credit card.</span></th>
<td>$50</td>
<td>$50</td>
<td class="current">$75</td>
</tr>
<tr class="total">
<th>Total <span class="sr-only">Liabilities</span></th>
<td>$750</td>
<td>$600</td>
<td class="current">$475</td>
</tr>
Step 25
For your third table, add acaption
with the textNet Worth
, and set up a table header and table body.
#index.html
<table>
<caption>Net Worth</caption>
<thead></thead>
<tbody></tbody>
</table>
Step 26
Within yourthead
, create atr
element. In that, add atd
and threeth
elements. Within each of theth
elements, add aspan
element with theclass
set tosr-only
and the following text, in order:2019
,2020
, and2021
.
#index.html
<table>
<caption>Net Worth</caption>
<thead>
<tr>
<td></td>
<th><span class="sr-only">2019</span></th>
<th><span class="sr-only">2020</span></th>
<th><span class="sr-only">2021</span></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Step 27
Within thetbody
, add atr
with theclass
set tototal
. In that, add ath
with the textTotal Net Worth
, and wrapNet Worth
in aspan
with theclass
set tosr-only
.
Then add threetd
elements, giving the third aclass
set tocurrent
, and giving each the following text:$-171
,$136
,$334
.
#index.html
<table>
<caption>Net Worth</caption>
<thead>
<tr>
<td></td>
<th><span class="sr-only">2019</span></th>
<th><span class="sr-only">2020</span></th>
<th><span class="sr-only">2021</span></th>
</tr>
</thead>
<tbody>
<tr class="total">
<th>Total <span class="sr-only">Net Worth</span></th>
<td>$-171</td>
<td>$136</td>
<td class="current">$334</td>
</tr>
</tbody>
</table>
Step 28
Time to style your table. Start by resetting the box model. Create anhtml
selector and give it abox-sizing
property set toborder-box
.
#styles.css
html {
box-sizing: border-box;
}
Step 29
Create abody
selector and give it afont-family
property set tosans-serif
and acolor
set to#0a0a23
.
#styles.css
body {
font-family: sans-serif;
color: #0a0a23;
}
Step 30
Before you get too far into your styling, you should make use of thesr-only
class. You can use CSS to make elements with this class completely hidden from the visual page, but still be announced by screen readers.
The CSS you are about to write is a common set of properties used to ensure elements are completely hidden visually.
Thespan[class~="sr-only"]
selector will select anyspan
element whoseclass
includessr-only
. Create that selector, and give it aborder
property set to0
.
#styles.css
span[class~="sr-only"] {
border: 0;
}
Step 31
The CSSclip
property is used to define the visible portions of an element. Set thespan[class~="sr-only"]
selector to have aclip
property ofrect(1px, 1px, 1px, 1px)
.
Theclip-path
property determines the shape theclip
property should take. Set both theclip-path
and-webkit-clip-path
properties to the value ofinset(50%)
, forming the clip-path into a rectangle within the element.
#styles.css
span[class~="sr-only"] {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
-webkit-clip-path: inset(50%);
}
Step 32
Now you need to size these elements down. Give yourspan[class~="sr-only"]
selector awidth
andheight
property set to1px
.
#styles.css
span[class~="sr-only"] {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
-webkit-clip-path: inset(50%);
width: 1px;
height: 1px;
}
Step 33
To prevent the text content from overflowing, give yourspan[class~="sr-only"]
selector anoverflow
property set tohidden
and awhite-space
property set tonowrap
.
#styles.css
span[class~="sr-only"] {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
-webkit-clip-path: inset(50%);
height: 1px;
width: 1px;
overflow: hidden;
white-space: nowrap;
}
Step 34
Finally, you need to take these hidden elements out of the document flow. Give thespan[class~="sr-only"]
selector aposition
property set toabsolute
, apadding
property set to0
, and amargin
property set to-1px
. This will ensure that not only are they no longer visible, but they are not even within the page view.
#styles.css
span[class~="sr-only"] {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
-webkit-clip-path: inset(50%);
height: 1px;
width: 1px;
overflow: hidden;
white-space: nowrap;
position: absolute;
padding: 0;
margin: -1px;
}
Step 35
Time to style your table heading. Create anh1
selector. Give it amax-width
property set to37.25rem
, amargin
property set to0 auto
, and apadding
property set to1.5rem 1.25rem
.
#styles.css
h1 {
max-width: 37.25rem;
margin: 0 auto;
padding: 1.5rem 1.25rem;
}
Step 36
Target your flex container with anh1 .flex
selector. Give it adisplay
property set toflex
to enable the flexbox layout. Then set theflex-direction
property tocolumn-reverse
- this will display the nested elements from bottom to top. Finally, set thegap
property to1rem
to create some space between the elements.
#styles.css
h1 .flex {
display: flex;
flex-direction: column-reverse;
gap: 1rem;
}
Step 37
The:first-of-type
pseudo-selector is used to target the first element that matches the selector. Create anh1 .flex span:first-of-type
selector to target the firstspan
element in your.flex
container. Remember that yourspan
elements are reversed, visually, so this will appear to be the second element on the page.
Give your new selector afont-size
property of0.7em
to make it look like a sub-heading.
#styles.css
h1 .flex span:first-of-type {
font-size: 0.7em;
}
Step 38
The:last-of-type
pseudo-selector does the exact opposite - it targets the last element that matches the selector. Create anh1 .flex span:last-of-type
selector to target the lastspan
in your flex container, and give it afont-size
property set to1.2em
to make it look like a header.
#styles.css
h1 .flex span:last-of-type {
font-size: 1.2em;
}
Step 39
You wrapped your table in a section element - now you can style that to give your table a border. Create asection
selector, and give it amax-width
property set to40rem
for responsive design. Set themargin
property to0 auto
to center it, and set theborder
property to2px solid #d0d0d5
.
#styles.css
section {
max-width: 40rem;
margin: 0 auto;
border: 2px solid #d0d0d5;
}
Step 40
The last part of your table heading is your years. Create a#years
selector, and enable flexbox. Justify the content to the end of the flex direction, and make the element sticky. Fix it to the top of its container withtop: 0
.
#styles.css
#years {
display: flex;
justify-content: flex-end;
position: sticky;
top: 0;
}
Step 41
Now apply some color to your#years
. Make the text#fff
and the background#0a0a23
.
#styles.css
#years {
display: flex;
justify-content: flex-end;
position: sticky;
top: 0;
color: #fff;
background-color: #0a0a23;
}
Step 42
Thecalc()
function is a CSS function that allows you to calculate a value based on other values. For example, you can use it to calculate the width of the viewport minus the margin of an element:#styles.css .example { margin: 10px; width: calc(100% - 20px); }Ensure your years do not get hidden by setting a
z-index
of999
. Then, give it amargin
of0 -2px
, and apadding
set to0.5rem calc(1.25rem + 2px) 0.5rem 0
.
#styles.css
#years {
display: flex;
justify-content: flex-end;
position: sticky;
top: 0;
background: #0a0a23;
color: #fff;
z-index: 999;
margin: 0 -2px;
padding: 0.5rem calc(1.25rem + 2px) 0.5rem 0;
}
Step 43
Style the text within your#years
element by creating a#years span[class]
selector. Thespan[class]
syntax will target anyspan
element that has aclass
attribute set, regardless of the attribute's value.
Give your new selector abold
font, a width of4.5rem
, and text aligned to the right.
#styles.css
#years span[class] {
font-weight: bold;
width: 4.5rem;
text-align: right;
}
Step 44
You wrapped your tables in a container with thetable-wrap
class. Create a selector for that class, and give it apadding
set to0 0.75rem 1.5rem 0.75rem
.
#styles.css
.table-wrap {
padding: 0 0.75rem 1.5rem 0.75rem;
}
Step 45
Before you start diving in to the table itself,your
span elements are currently bolded. Create aspan:not(.sr-only)
selector and give it afont-weight
property set tonormal
.
The:not()
pseudo-selector is used to target all elements that do not match the selector - in this case, any of yourspan
elements that do not have thesr-only
class. This ensures that your earlier rules for thespan[class~="sr-only"]
selector are not overwritten.
#styles.css
span:not(.sr-only) {
font-weight: normal;
}
Step 46
Rather than having to constantly double-check you are not overwriting your earlier properties, you can use the!important
keyword to ensure these properties are always applied, regardless of order or specificity.
Give each property in yourspan[class~="sr-only"]
selector an!important
keyword. Do not change any of the values.
#styles.css
span[class~="sr-only"] {
border: 0 !important;
clip: rect(1px, 1px, 1px, 1px) !important;
clip-path: inset(50%) !important;
-webkit-clip-path: inset(50%) !important;
height: 1px !important;
width: 1px !important;
position: absolute !important;
overflow: hidden !important;
white-space: nowrap !important;
padding: 0 !important;
margin: -1px !important;
}
Step 47
Now that you have added the!important
keyword, you can remove the:not(.sr-only)
from yourspan
selector.
#styles.css
span {
font-weight: normal;
}
Step 48
Create atable
selector to target your tables. Set theborder-collapse
property tocollapse
, which will allow cell borders to collapse into a single border, instead of a border around each cell. Also set theborder
property to0
to hide the borders themselves.
#styles.css
table {
border-collapse: collapse;
border: 0;
}
Step 49
Ensure your table fills its container with awidth
property set to100%
, then position it relatively and give it a top margin of3rem
.
#styles.css
table {
border-collapse: collapse;
border: 0;
width: 100%;
position: relative;
margin-top: 3rem;
}
Step 50
Next you need to style yourcaption
elements to look more like headers. Create atable caption
selector. Set the text to have a color of#356eaf
, a size of1.3em
, and a normal weight.
#styles.css
table caption {
color: #356eaf;
font-size: 1.3em;
font-weight: normal;
}
Step 51
Now give the captions an absolute position, and shift them-2.25rem
from the top and0.5rem
from the left.
#styles.css
table caption {
color: #356eaf;
font-size: 1.3em;
font-weight: normal;
position: absolute;
top: -2.25rem;
left: 0.5rem;
}
Step 52
Create a selector to target yourtd
elements within your table body. Give them a width to fill the viewport, with a minimum and maximum of4rem
. This approach ensures that the width is fixed, whereas settingwidth
specifically would allow the elements to shrink to the container (because we are using flexbox).
#styles.css
tbody td {
width: 100vw;
min-width: 4rem;
max-width: 4rem;
}
Step 53
Now target theth
elements within your table body, and give them a width of the entire container, less12rem
.
#styles.css
tbody th {
width: calc(100% - 12rem);
}
Step 54
The[attribute="value"]
selector targets any element that has an attribute with a specific value. Create atr[class="total"]
selector to target specifically yourtr
elements with thetotal
class. Give it a bottom border of4px double #0a0a23
and make the font bold.
#styles.css
tr[class="total"] {
border-bottom: 4px double #0a0a23;
font-weight: bold;
}
Step 55
Using the same selector syntax, target theth
elements within your table rows where theclass
istotal
. Align the text to the left, and give them a padding of0.5rem 0 0.25rem 0.5rem
.
#styles.css
tr[class="total"] th {
text-align: left;
padding: 0.5rem 0 0.25rem 0.5rem;
}
Step 56
The key difference betweentr[class="total"]
andtr.total
is that the first will selecttr
elements where the only class istotal
. The second will selecttr
elements where the class includes total.
In your case,tr.total
will work. You can use this selector to target alltd
elements within your.total
rows. Align the text to the right, and give them a padding of0 0.25rem
.
#styles.css
tr.total td {
text-align: right;
padding: 0 0.25rem;
}
Step 57
The:nth-of-type()
pseudo-selector is used to target specific elements based on their order among siblings of the same type. Use this pseudo-selector to target the thirdtd
element within yourtotal
table rows. Give it a right padding of0.5rem
.
#styles.css
tr.total td:nth-of-type(3) {
padding: 0.5rem;
}
Step 58
Give yourtr.total
elements a hover effect that changes the background to#99c9ff
.
#styles.css
tr.total:hover {
background-color: #99c9ff;
}
Step 59
Select yourtd
elements with theclass
value ofcurrent
, and make the font italic.
#styles.css
td.current {
font-style: italic;
}
Step 60
Select thetr
elements with theclass
set todata
. Give them a background image oflinear-gradient(to bottom, #dfdfe2 1.845rem, white 1.845rem)
.
#styles.css
tr.data {
background-image: linear-gradient(to bottom, #dfdfe2 1.845rem, white 1.845rem);
}
Step 61
Select theth
elements within yourtr.data
elements. Align the text to the left, and give them a top padding of0.3rem
and a left padding of0.5rem
.
#styles.css
tr.data th {
text-align: left;
padding-top: 0.3rem;
padding-left: 0.5rem;
}
Step 62
Create atr.data th .description
selector to target the elements with theclass
set todescription
that are within yourth
elements in your.data
table rows. Give them a block display, make the text italic with a normal weight, and position them with apadding
set to1rem 0 0.75rem
and a right margin of-13.5rem
.
#styles.css
tr.data th .description {
display: block;
font-style: italic;
font-weight: normal;
padding: 1rem 0 0.75rem;
margin-right: -13.5rem;
}
Step 63
Yourspan
elements now all have more specific styling, which means you can remove yourspan
rule.
#styles.css
span {
font-weight: normal;
}
/*Delete all!*/
Step 64
Your dollar amounts are currently misaligned. Create a selector to target thetd
elements within yourtr.data
elements. Vertically align the text to the top, horizontally align the text to the right, and set the padding to0.3rem 0.25rem 0
.
#styles.css
tr.data td {
vertical-align: top;
text-align: right;
padding: 0.3rem 0.25rem 0;
}
Step 65
Create another selector for thetd
elements within yourtr.data
element, but specifically select the last one. Give this a right padding of0.5rem
.
With this, your balance sheet is complete!
#styles.css
tr.data td:last-of-type {
padding-right: 0.5rem;
}