css一些不常見但很有用的屬性操作大全
發(fā)布時間:2020-09-28 15:34:03 作者:gqkmiss
我要評論
這篇文章主要介紹了css一些不常見但很有用的屬性操作大全,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
1、自定義文本選擇
::selection {
background: red;
color: black;
}
2、去掉video的controls中的下載按鈕
video::-internal-media-controls-download-button {
display:none;
}
video::-webkit-media-controls-enclosure {
overflow:hidden;
}
video::-webkit-media-controls-panel {
width: calc(100% + 30px);
}
3、css3特性中的transform:translateZ(0)有什么作用
GPU加速,優(yōu)化前端性能
4、滾動條樣式修改
/* * 可以換其他選擇器 */
*::-webkit-scrollbar {
width: 2px;
height: 2px;
}
*::-webkit-scrollbar-thumb {
border-radius: 5px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: #00063a;
}
*::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
background: #00063a;
}
5、input type number 隱藏上下按鈕
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
input[type="number"]{
-moz-appearance: textfield;
}
6、css漸變虛框
<style>
.box {
width: 150px;
border: 2px dashed #fff;
background: linear-gradient(to bottom, #34538b, #cd0000);
background-origin: border-box;
}
.content {
height: 100px;
background-color: #fff;
}
</style>
<div class="box">
<div class="content"></div>
</div>

7、border漸變色圓角
<style type="text/css">
.content {
width: 100px;
height: 100px;
box-sizing: border-box;
padding: 5px;
border-radius: 50%;
background-image: -webkit-linear-gradient(top, red 0%, blue 30%, yellow 60%, green 90%);
background-image: -moz-linear-gradient(top, red 0%, blue 30%, yellow 60%, green 90%);
background-image: linear-gradient(top, red 0%, blue 30%, yellow 60%, green 90%);
}
.box {
width:100%;
height:100%;
border-radius:50%;
background:#fff;
}
</style>
<div class="content">
<div class="box"></div>
</div>

8、輸入框光標(biāo)變色,文字不變色
input{
caret-color: red;
}

9、錐形漸變
.box {
width: 300px; height: 300px;
background: conic-gradient(from 45deg, white, black, white);
}

10、 text-decoration實現(xiàn)波浪線
wavy {
display: block;
height: .5em;
white-space: nowrap;
letter-spacing: 100vw;
padding-top: .5em;
overflow: hidden;
}
wavy::before {
content: "\2000\2000";
/* IE瀏覽器實線代替 */
text-decoration: overline;
/* 現(xiàn)代瀏覽器 */
text-decoration: overline wavy;
}

11、css三角形
<style type="text/css" media="screen">
.div1{
width: 0;
height: 0;
border: 100px solid;
<!--上右下左-->
border-color: red transparent transparent transparent;
}
</style>
<div class="div1"></div>

12、css背景漸變與背景圖片并存
background: url(https://img.alicdn.com/imgextra/i4/1881744325/O1CN01JBktT81hotb8c6Py0_!!1881744325.png) center no-repeat,linear-gradient(to bottom,red,#3c3f40);

13、自定義瀏覽器滾動條
/*定義滾動條寬高及背景,寬高分別對應(yīng)橫豎滾動條的尺寸*/
::-webkit-scrollbar {
width: 5px;
height: 5px;
background-color: rgba(245, 245, 245, 0.47);
}
/*定義滾動條的軌道,內(nèi)陰影及圓角*/
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
border-radius: 10px;
background-color: #f5f5f5;
}
/*定義滑塊,內(nèi)陰影及圓角*/
::-webkit-scrollbar-thumb {
/*width: 10px;*/
height: 20px;
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
background-color: rgba(85, 85, 85, 0.25);
}
14、改變placeholder的字體顏色大小
input::-webkit-input-placeholder {
/* WebKit browsers */
font-size:14px;
color: #333;
}
input::-moz-placeholder {
/* Mozilla Firefox 19+ */
font-size:14px;
color: #333;
}
input:-ms-input-placeholder {
/* Internet Explorer 10+ */
font-size:14px;
color: #333;
}
到此這篇關(guān)于css一些不常見但很有用的屬性操作大全的文章就介紹到這了,更多相關(guān)css 屬性操作內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章

css中filter屬性和backdrop-filter的應(yīng)用與區(qū)別詳解
這篇文章主要介紹了css中filter屬性和backdrop-filter的應(yīng)用與區(qū)別詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面2020-09-14
這篇文章主要介紹了HTML5中CSS外觀屬性的相關(guān)知識,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,,需要的朋友可以參考下2020-09-10
這篇文章主要介紹了CSS中簡寫屬性要注意TRouBLe的順序問題(避免踩坑),本文通過實例代碼給大家介紹的非常詳細(xì),大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參2020-08-10
這篇文章主要介紹了CSS字體、文本、列表屬性的相關(guān)知識,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-22
這篇文章主要介紹了奇妙的 CSS 屬性 MASK,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧2020-07-07
這篇文章主要介紹了CSS 繼承 inherit屬性的方法,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-05-09
利用CSS中的 outline-offset 屬性實現(xiàn)加號
這篇文章主要介紹了利用CSS中的 outline-offset 屬性實現(xiàn)加號,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-04-17







