Heim > Web-Frontend > HTML-Tutorial > css小技巧 - 我_爱编程

css小技巧 - 我_爱编程

WBOY
Freigeben: 2016-05-22 17:19:52
Original
1085 Leute haben es durchsucht

网页字体

font-size: 16px;<span style="color: #800000;">font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif; 网络常用来显高大上的名言警句字体 </span>
Nach dem Login kopieren
<span style="color: #800000;">font: 12px "宋体", Arial, Helvetica, sans-serif; 普通内容字体<br><span class="styles-clipboard-only"> <span class="webkit-css-property">color: <span class="expand-element"><span class="value"><span><span class="color-swatch"><span class="color-swatch-inner">#474645; 内容小标题 以及内容<br> line-height: 20px 内容行高<br></span></span></span></span></span></span></span></span>
Nach dem Login kopieren
  1. font-weight: bold; 字体加粗
  • color: #838383;
  • background: #f6f6f6; 颜色较浅的地方
<span style="color: #800000;"> </span>
Nach dem Login kopieren
Nach dem Login kopieren

选择器

<span style="color: #800000;">.texts p:nth-child(2)</span>{}<span style="color: #800000;"> :取texts 类下的第二个p
:hover </span>{}<span style="color: #800000;">:当鼠标移到</span>
Nach dem Login kopieren

动画控制

    <span style="color: #008000;">/*</span><span style="color: #008000;"> -webkit-transition: all 1s; </span><span style="color: #008000;">*/</span><span style="color: #800000;">
    -moz-transition: all 1s;       
    -o-transition: all 1s;
    transition: all 1s;        /*动画共1秒
    </span><span style="color: #008000;">/*</span><span style="color: #008000;"> -webkit-transform: translate(60px); </span><span style="color: #008000;">*/</span><span style="color: #800000;">
    -moz-transform: translate(60px);        /*沿x轴向右移60px*/
    -o-transform: translate(60px);
    -ms-transform: translate(60px);
    </span><span style="color: #008000;">/*</span><span style="color: #008000;"> transform: translate(60px); </span><span style="color: #008000;">*/<br></span><span style="color: #888888;">-moz-transform: scale(1.1)      图片放大</span><span style="color: #008000;"><br><br></span>
Nach dem Login kopieren

整体效果调整

<span style="color: #800000;">letter-spacing: 2px;  字与字间隔2px
text-shadow:0px 1px rgba(255,255,255,0.3) 字阴影
 box-shadow: #999 4px 5px 1px;  块区域阴影<br>overflow: hidden; 多余部分隐藏<br></span>border-radius: 100%;<span style="line-height: 1.5;">overflow: </span><span style="line-height: 1.5;">hidden; 变成圆形后 ,需设置内容隐藏<br><span class="webkit-css-property">border-radius: <span class="expand-element"><span class="value">0 20px 20px 0;  右半圆<br><span class="styles-clipboard-only"> <span class="webkit-css-property">box-shadow: <span class="expand-element"><span class="value">-2px -1px 5px <span><span class="color-swatch"><span class="color-swatch-inner">#666;</span></span></span></span></span></span></span><br></span></span></span><br></span>
Nach dem Login kopieren
<span style="color: #800000;"> </span>
Nach dem Login kopieren
Nach dem Login kopieren

扩展知识

<span style="color: #800000;">line-height: 28px;  为达效果,当高度不能更改时,可以试着用行高<br><span class="webkit-css-property">display: <span class="expand-element"><span class="value">block  如果未达效果,试着设置</span></span></span><br><span style="font-size: 13px;"><strong><span class="styles-clipboard-only"><span class="webkit-css-property">border-bottom: <span class="expand-element"><span class="value"><span class="color-swatch"><span class="color-swatch-inner">#474645 2px solid; 画一条线<br>margin: 0 20px 20px 20px  上 右 下 左<br></span></span></span></span></span></span></strong></span></span><strong>margin: 20px auto   上下  左右<br></strong><strong>margin:   20px 20px </strong><strong> 20px  上  左右  下<br>阅读全文>> 伪元素:给部分整体前添加 元素 并控制</strong>
Nach dem Login kopieren
<span style="color: #800000;">.blogs::before </span>{<span style="color: #ff0000;"> content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;"> height</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;"> border-radius</span>:<span style="color: #0000ff;"> 50%</span>;<span style="color: #ff0000;"> position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> background</span>:<span style="color: #0000ff;"> #cac1c1</span>;<span style="color: #ff0000;"> border</span>:<span style="color: #0000ff;"> 2px solid #fff</span>;<span style="color: #ff0000;"> left</span>:<span style="color: #0000ff;"> -27px</span>;<span style="color: #ff0000;"> -webkit-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -moz-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -o-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> transition</span>:<span style="color: #0000ff;"> all 1s</span>; }<span style="color: #800000;">
.blogs:hover::before </span>{<span style="color: #ff0000;"> background</span>:<span style="color: #0000ff;"> #474645 </span>}<span style="color: #800000;">
.dateview </span>{<span style="color: #ff0000;"> position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> left</span>:<span style="color: #0000ff;"> -125px</span>;<span style="color: #ff0000;"> top</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;"> z-index</span>:<span style="color: #0000ff;"> 1</span>;<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> #F5F5F5</span>; }<span style="color: #800000;">
.blogs::after </span>{<span style="color: #ff0000;"> content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;"> 121px</span>;<span style="color: #ff0000;"> height</span>:<span style="color: #0000ff;"> 29px</span>;<span style="color: #ff0000;"> position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> left</span>:<span style="color: #0000ff;"> -148px</span>;<span style="color: #ff0000;"> top</span>:<span style="color: #0000ff;"> -9px</span>;<span style="color: #ff0000;"> z-index</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> background</span>:<span style="color: #0000ff;"> #474645 url(../images/ti.png) no-repeat</span>;<span style="color: #ff0000;"> opacity</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> -webkit-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -moz-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -o-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> transition</span>:<span style="color: #0000ff;"> all 1s</span>; }<span style="color: #800000;">
.blogs:hover::after </span>{<span style="color: #ff0000;"> opacity</span>:<span style="color: #0000ff;"> 1 </span>}<br>或者:
Nach dem Login kopieren
<span style="color: #800000;">a:before
</span>{ <code>content: " (" attr(href) ")";</code>}
Nach dem Login kopieren

 a伪元素

<span style="color: #800000;">选择未访问、已访问、悬浮和活动链接,并设置它们的样式:
a:link    </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">blue</span>;}<span style="color: #800000;">
a:visited </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">blue</span>;}<span style="color: #800000;">
a:hover   </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">red</span>;}<span style="color: #800000;">
a:active  </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">yellow</span>;}
Nach dem Login kopieren

 

 

 结尾:给自己的的页面设置分享按钮 例如:分享到QQ 、新浪 、人人、微信 等等  

分享按钮-百度分享

它会告诉你

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage