- Cross-platform Desktop Application Development:Electron,Node,NW.js,and React
- Dmitry Sheiko
- 304字
- 2021-07-15 17:36:26
Styling the footer
Eventually, we now reached the footer:
./index.html
...
<footer class="l-app__footer footer">
<h2 class="footer__header">File Explorer</h2>
<select class="footer__select">
<option value="en-US">English</option>
<option value="de-DE">Deutsch</option>
</select>
</footer>
We arrange the application title to the left and language selector to the right. What do we use to lay this out? Obviously, Flexbox:
./assets/css/Component/footer.css
.footer {
...
display: flex;
flex-flow: row nowrap;
justify-content: flex-end;
}
.footer__header {
margin: 0.2em auto 0 0;
font-size: 1em;
}
It's a special case. We set items to align right in general, but have reset it for the .footer__header item that snuggles against the left border driven by margin-right: auto:

While looking at the result, I think it would be nice to emphasize the functional meaning of some UI elements with icons. I personally prefer the icon font of Material Design system (https://material.io/icons/). So, as described in the Developer Guide (http://google.github.io/material-design-icons/), we include the corresponding Google Web Font to index.html:
./index.html
<link
rel="stylesheet">
I would suggest that you dedicate a component that will represent an icon and fill it with the rule set suggested by Material Design:
./assets/css/Component/icon.css
.icon {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 16px;
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
Now, we can add an icon anywhere in HTML, as simple as that:
<i class="material-icons">thumb_up</i>
Why not then make a folder icon accompanying items in the directory list?:
<li class="dir-list__li"><i class="icon">folder</i>assets</li>
I believe that a globe icon will get along nicely with the language selector. So we modify the HTML:
./index.html
...
<footer class="l-app__footer footer">
<h2 class="footer__header">File Explorer</h2>
<label class="icon footer__label">language</label>
....
and we add a class in the CSS:
./assets/css/Component/footer.css
...
.footer__label {
margin-right: 0.2em;
font-size: 1.4em;
margin-top: 0.1em;
}
As we run the application we can see an icon rendered next to the language selector control:

If something went wrong after running the application, you can always call for Developer Tools--just press F12:

- Instant Testing with CasperJS
- 工程軟件開發(fā)技術(shù)基礎(chǔ)
- PostgreSQL Cookbook
- Python Deep Learning
- 云原生Spring實戰(zhàn)
- C++新經(jīng)典
- Android程序設(shè)計基礎(chǔ)
- AIRIOT物聯(lián)網(wǎng)平臺開發(fā)框架應(yīng)用與實戰(zhàn)
- 智能手機故障檢測與維修從入門到精通
- Distributed Computing in Java 9
- Getting Started with Python
- Practical GIS
- NGUI for Unity
- 計算語言學(xué)導(dǎo)論
- 快樂編程:青少年思維訓(xùn)練