2.1 CSS三角
網(wǎng)頁中常見的一些三角形, 使用CSS直接畫出來就可以, 不必做成圖片或者字體圖標。
CSS三角做法代碼:
div {
width: 0;
height: 0;
/* 兼顧兼容性
line-height: 0;
font-size: 0; */
border: 50px solid transparent;
border-left-color: pink;
}
2.2 CSS三角強化
語法:
width: 0;
height: 0;
/* 1.只保留右邊的邊框有顏色 */
border-color: transparent skyblue transparent transparent;
/* 2.樣式都是solid */
border-style: solid;
/* 3.上邊框寬度要大,右邊框寬度稍小,其余邊框為0 */
border-width: 100px 50px 0 0;
【示例代碼】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.prc {
width: 160px;
height: 24px;
border: 1px solid red;
margin: 0 auto;
line-height: 24px;
}
.miaosha {
position: relative;
float: left;
width: 90px;
height: 100%;
background-color: red;
text-align: center;
color: #fff;
font-weight: 700;
margin-right: 8px;
}
.miaosha i {
position: absolute;
right: 0;
top: 0;
width: 0;
height: 0;
border-color: transparent #fff transparent transparent;
border-style: solid;
border-width: 24px 10px 0 0;
}
.de {
font-size: 12px;
color: gray;
text-decoration: line-through;
}
</style>
</head>
<body>
<div class="prc">
<span class="miaosha">
¥1650
<i></i>
</span>
<span class="de">¥5650</span>
</div>
</body>
</html>
2.3 什么是界面樣式
所謂的界面樣式,就是更改一些用戶操作樣式,以便提高更好的用戶體驗。
●更改用戶的鼠標樣式
●表單輪廓
●防止表單域拖拽
2.4 鼠標樣式cursor
li {cursor: pointer; }
設置或檢索在對象上移動的鼠標指針采用何種系統(tǒng)預定義的光標形狀。
2.5 輪廓線outline
給表單添加 outline:0; 或者 outline: none; 樣式之后, 就可以去掉默認的藍色邊框。文章來源:http://www.zghlxwxcb.cn/news/detail-596731.html
input { outline: none; }
2.6 防止拖拽文本域resize
實際開發(fā)中,我們文本域右下角是不可以拖拽的。文章來源地址http://www.zghlxwxcb.cn/news/detail-596731.html
textarea{ resize: none; }
到了這里,關于4. CSS用戶界面樣式的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!