<html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>巢狀規則 - www.tw511.com</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h1>My First Heading</h1>
<p>It is a CSS pre-processor which helps to reduce repetition with CSS and save the time. </p>
<p>It is more stable and powerful CSS extension language.</p>
<div class="box">
<h1>My Second Heading</h1>
<p>It is initially designed by Hampton Catlin and developed by Natalie Weizenbaum in 2016.</p>
</div>
</div>
</body>
</html>
.container{ h1{ font-size: 25px; color:#E45456; } p{ font-size: 25px; color:#3C7949; } .box{ h1{ font-size: 25px; color:#E45456; } p{ font-size: 25px; color:#3C7949; } } }
sass --watch C:\Ruby22-x64\style.scss:style.css
接下來執行上面的命令,它會自動建立style.css檔案,如下面的程式碼:
.container h1 { font-size: 25px; color: #E45456; } .container p { font-size: 25px; color: #3C7949; } .container .box h1 { font-size: 25px; color: #E45456; } .container .box p { font-size: 25px; color: #3C7949; }