您好,登錄后才能下訂單哦!
.rounded-corners(@radius:5px){ -webkit-border-radius: @radius; -moz-border-radius: @radius; -ms-border-radius: @radius; -o-border-radius: @radius; border-radius:@radius; } #header { .rounded-corners; } #footer { .rounded-corners(10px); }
.rounded-corners表示函數(shù)名 (@radius:5px)表示函數(shù)的參數(shù) { -webkit-border-radius: @radius; -moz-border-radius: @radius; -ms-border-radius: @radius; -o-border-radius: @radius; border-radius:@radius; }表示函數(shù)體也就是內(nèi)容 #header { .rounded-corners; }表示調(diào)用函數(shù)使用默認(rèn)參數(shù)5px #footer { .rounded-corners(10px); }表示調(diào)用函數(shù)并給函數(shù)傳遞參數(shù)
函數(shù)名(參數(shù)){ 函數(shù)體 }
#header { -webkit-border-radius: 5px; -moz-border-radius: 5px; -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; } #footer { -webkit-border-radius: 10px; -moz-border-radius: 10px; -ms-border-radius: 10px; -o-border-radius: 10px; border-radius: 10px; }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>less2</title> <link rel="stylesheet" href="example2.css"> <style> div{ width: 100px; height: 100px; border: 1px solid #ccc; } </style> </head> <body> <div id="header"></div> <div id="footer"></div> </body> </html>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。