目錄
内容简介:本文收集了我常用的CSS代码片段!
*reset
*input兼容
*css圆角
*水平翻转
*垂直翻转
*css旋转
*css盒阴影
*clearfix清浮动
*锚点
*纯CSS三角形
*opacity透明
*选择文本颜色
*全屏背景
*强制滚动条
*渐变gradient
*font-face
*png透明
*min-height
首頁 web前端 html教學 【HTML+CSS基础】代码片段_html/css_WEB-ITnose

【HTML+CSS基础】代码片段_html/css_WEB-ITnose

Jun 24, 2016 pm 12:06 PM

内容简介:本文收集了我常用的CSS代码片段!

*reset

/** reset **/body, h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, form, textarea { margin: 0; }body { font-family: arial, \5b8b\4f53; font-size: 12px; line-height: 1.5; }h1, h2, h3, h4, h5, h6, input, textarea, section { font-size: 100%; }input, textarea, section { font-family: inherit; }ul, ol { padding-left: 0; list-style-type: none; }table{ border-collapse:collapse; border-spacing:0; }th, td { padding: 0; }em,th,var{font-style:normal;}img { border: 0 none; vertical-align:top; }a { text-decoration:none; }a:hover{text-decoration:underline; }
登入後複製

*input兼容

.ipt {    border: 1px solid #469021;    background: #64A246;    color: #fff;    font:bold 11px arial,sans-serif;    padding: 0.25em 0.5em;    text-transform: uppercase;    margin: 0;    overflow: visible;    height: 27px;    line-height: 19px;    _line-height: 16px;    width: 80px;}
登入後複製

*css圆角

.radius {    -moz-border-radius: 30px;    -webkit-border-radius: 30px;    border-radius: 30px;}
登入後複製

*水平翻转

.flipx {    -moz-transform:scaleX(-1);    -webkit-transform:scaleX(-1);    -o-transform:scaleX(-1);    transform:scaleX(-1);    filter:FlipH();}
登入後複製

*垂直翻转

.flipy {    -moz-transform:scaleY(-1);    -webkit-transform:scaleY(-1);    -o-transform:scaleY(-1);    transform:scaleY(-1);    filter:FlipV();}
登入後複製

*css旋转

.rotate90 {    filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);    -moz-transform: rotate(90deg);    -o-transform: rotate(90deg);    -webkit-transform: rotate(90deg);    transform: rotate(90deg);}
登入後複製

*css盒阴影

.box_shadow {    -moz-box-shadow: 3px 3px 4px #000;     -webkit-box-shadow: 3px 3px 4px #000;     box-shadow: 3px 3px 4px #000;    filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=3px, OffY=3px, Color='#000');     -ms-filter: "progid:DXImageTransform.Microsoft.dropshadow(OffX=3px, OffY=3px, Color='#000')";}
登入後複製

*clearfix清浮动

.clearfix:before, .clearfix:after { content:""; display:table; }.clearfix:after{ clear:both; }.clearfix{ *zoom:1;}
登入後複製

*锚点

<a name="link">不能为空</a><a href="#link">锚点链接</a>
登入後複製

*纯CSS三角形

.triangle {    width: 0;    height: 0;    font-size: 0;    line-height: 0;    border-width: 50px;    border-style: solid;    border-top-color: #fff;    border-right-color: #fff;    border-bottom-color: red;    border-left-color: #fff;}
登入後複製

*opacity透明

/*opacity*/.opacity {    filter: alpha(opacity=50);    -khtml-opacity: 0.5;    -moz-opacity: 0.5;    opacity: 0.5;}
登入後複製

*选择文本颜色

/* 自定义文本选择颜色 */::selection { background: #e2eae2; }::-moz-selection { background: #e2eae2; }::-webkit-selection { background: #e2eae2; }
登入後複製

*全屏背景

/* 全屏背景 */.cover {    background: url('bg.jpg') no-repeat center center fixed;    -webkit-background-size: cover;    -moz-background-size: cover;    -o-background-size: cover;    background-size: cover;}
登入後複製

*强制滚动条

html { height: 101% }
登入後複製

*渐变gradient

/* 渐变 */.gradient {    background: #629721;    background-image: -webkit-gradient(linear, left top, left bottom, from(#83b842), to(#629721));    background-image: -webkit-linear-gradient(top, #83b842, #629721);    background-image: -moz-linear-gradient(top, #83b842, #629721);    background-image: -ms-linear-gradient(top, #83b842, #629721);    background-image: -o-linear-gradient(top, #83b842, #629721);    background-image: linear-gradient(top, #83b842, #629721);}
登入後複製

*font-face

/*font-face*/@font-face {    font-family: 'MyWebFont';    src: url('webfont.eot'); /* IE9 Compat Modes */    src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */    url('webfont.woff') format('woff'), /* Modern Browsers */    url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */    url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */}body {    font-family: 'MyWebFont', Arial, sans-serif;}
登入後複製

*png透明

/* png透明 */.png {    width:200px;    height:100px;    background: url(this.png) no-repeat;    _background:none;    _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='this.png',sizingMethod='crop');/* 路径相对于html */}
登入後複製

*min-height

/* 最小高度 */.minheight {    min-height: 550px;    height: auto !important;    height: 550px;}
登入後複製

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗? 公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗? Mar 04, 2025 pm 12:32 PM

公眾號網頁更新緩存難題:如何避免版本更新後舊緩存影響用戶體驗?

如何使用HTML5表單驗證屬性來驗證用戶輸入? 如何使用HTML5表單驗證屬性來驗證用戶輸入? Mar 17, 2025 pm 12:27 PM

如何使用HTML5表單驗證屬性來驗證用戶輸入?

如何高效地在網頁中為PNG圖片添加描邊效果? 如何高效地在網頁中為PNG圖片添加描邊效果? Mar 04, 2025 pm 02:39 PM

如何高效地在網頁中為PNG圖片添加描邊效果?

HTML5中跨瀏覽器兼容性的最佳實踐是什麼? HTML5中跨瀏覽器兼容性的最佳實踐是什麼? Mar 17, 2025 pm 12:20 PM

HTML5中跨瀏覽器兼容性的最佳實踐是什麼?

我如何使用html5&lt; time&gt; 元素以語義表示日期和時間? 我如何使用html5&lt; time&gt; 元素以語義表示日期和時間? Mar 12, 2025 pm 04:05 PM

我如何使用html5&lt; time&gt; 元素以語義表示日期和時間?

&lt; datalist&gt;的目的是什麼。 元素? &lt; datalist&gt;的目的是什麼。 元素? Mar 21, 2025 pm 12:33 PM

&lt; datalist&gt;的目的是什麼。 元素?

&gt; gt;的目的是什麼 元素? &gt; gt;的目的是什麼 元素? Mar 21, 2025 pm 12:34 PM

&gt; gt;的目的是什麼 元素?

&lt; meter&gt;的目的是什麼。 元素? &lt; meter&gt;的目的是什麼。 元素? Mar 21, 2025 pm 12:35 PM

&lt; meter&gt;的目的是什麼。 元素?

See all articles