Variables
Imagine that you are coding the web page for your company; you define the style sheet, and, of course, you have a font standard color for all titles, body text, and so on. You are writing your CSS classes and notes that you need to repeat the same color value on more than one class definition. Okay, it’s not so hard to copy and paste the same value across my entire file. You finally present that web page to your UX designer and oh, surprise! That red doesn’t have to be so deep. You need to correct to the new color code. What does that mean? You will need to pe into your style sheet and manually change each color value for the new one.
Like other programming languages, with CSS preprocessors, we can define variables to reuse them across our style sheet, avoid repeating the same value, and save time when we need to adjust or change that same value. Let’s look at an example:
SASS syntax:
$my-height: 160px;
p {
height: $my-height;
}
Then, LESS syntax:
@my-height: 160px;
p {
font-size: @my-height;
}
They're pretty similar right? Let's explore other features!
- Modern JavaScript Web Development Cookbook
- Mastering Machine Learning for Penetration Testing
- Twilio Cookbook
- 物聯(lián)網(wǎng)之魂:物聯(lián)網(wǎng)協(xié)議與物聯(lián)網(wǎng)操作系統(tǒng)
- 物聯(lián)網(wǎng)檢驗檢測技術(shù)
- 物聯(lián)網(wǎng)信息安全
- SD-WAN架構(gòu)與技術(shù)(第2版)
- 網(wǎng)管員必讀:網(wǎng)絡(luò)管理(第2版)
- IPv6網(wǎng)絡(luò)切片:使能千行百業(yè)新體驗
- 新手易學(xué):新手學(xué)淘寶開店
- 紅藍(lán)攻防:構(gòu)建實(shí)戰(zhàn)化網(wǎng)絡(luò)安全防御體系
- AIoT應(yīng)用開發(fā)與實(shí)踐
- Python Web Scraping Cookbook
- 從實(shí)踐中學(xué)習(xí)Kali Linux網(wǎng)絡(luò)掃描
- Telerik WPF Controls Tutorial