Home > Web Front-end > HTML Tutorial > css小技巧 - 我_爱编程

css小技巧 - 我_爱编程

WBOY
Release: 2016-05-22 17:19:52
Original
1080 people have browsed it

网页字体

font-size: 16px;<span style="color: #800000;">font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif; 网络常用来显高大上的名言警句字体 </span>
Copy after login
<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>
Copy after login
  1. font-weight: bold; 字体加粗
  • color: #838383;
  • background: #f6f6f6; 颜色较浅的地方
<span style="color: #800000;"> </span>
Copy after login
Copy after login

选择器

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

动画控制

    <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>
Copy after login

整体效果调整

<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>
Copy after login
<span style="color: #800000;"> </span>
Copy after login
Copy after login

扩展知识

<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>
Copy after login
<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>或者:
Copy after login
<span style="color: #800000;">a:before
</span>{ <code>content: " (" attr(href) ")";</code>}
Copy after login

 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>;}
Copy after login

 

 

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

分享按钮-百度分享

它会告诉你

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template