CSS基础2

2017-07-12  本文已影响0人  草木不语只深深绿

文本

<style>
div#colorful{
  color:pink
}
</style>
<div id="colorful">
  粉红色
</div>
<style>
div#left{
  text-align:left;
}
/*让div和span的边框显露出来,便于理解本知识点*/
div,span{
  border: 1px gray solid;
  margin:10px;
} 
div#right{
  text-align:right;
} 
div#center{
  text-align:center;
} 
span#right{
  text-align:right;
} 
</style>
<div id="left">
左对齐
</div> 
<div id="right">
右对齐
</div> 
<div id="center">
居中
</div>
<span id="right">
span看不出右对齐效果 
</span>
<style type="text/css">
h1 {text-decoration: overline}
h2 {text-decoration: line-through}
h3 {text-decoration: underline}
h4 {text-decoration:blink}
.a {text-decoration: none}
</style>
<h1>上划线</h1>
<h2>删除效果</h2>
<h3>下划线</h3>
<h4>闪烁效果,大部分浏览器已经取消该效果</h4>
<a href="http://how2j.cn/">默认的超链</a>
<a class="a" href="http://how2j.cn/">去掉了下划线的超链</a>
<style>
p{
  width:200px; 
}
.p{
  line-height:200%;
}
</style>
<p>
默认行间距
默认行间距
默认行间距
默认行间距
</p>
<p class="p">
200%行间距
200%行间距
200%行间距
200%行间距
</p>
<style>
p{
  width:200px; 
} 
.p{
  letter-spacing:2;
}
</style> 
<p>
abcdefg abcdefg 
</p>
<p class="p">
abcdefg abcdefg
</p>
<style>
p{
  width:200px; 
} 
.p{
  word-spacing:10;
}
</style> 
<p>
abcdefg abcdefg 
</p> 
<p class="p">
abcdefg abcdefg 
</p>
<style>
p{
  width:200px;
} 
.p{
  text-indent:50;
}
</style>
<p>
没有缩进效果的一段文字没有缩进效果的一段文字
</p>
<p class="p">
有缩进效果的一段文字有缩进效果的一段文字
</p>
<style>
p.u {text-transform:uppercase}
p.c {text-transform:capitalize}
p.l {text-transform:lowercase} 
</style> 
<p class="u">abcD</p> 
<p class="c">abcD</p> 
<p class="l">abcD</p>

字体

<style>
p.big{font-size:30px;}
p.small{font-size:50%;}  
p.small2{font-size:0.5em;}  
</style>
<p >正常大小</p>
<p class="big">30px大小的文字</p>
<p class="small">50%比例的文字</p>
<p class="small2">0.5em 等同于 50%比例的文字</p>
<style>
p.n{font-style:normal;}
p.i{font-style:italic;}
</style> 
<p >标准字体</p>
<p class="n">标准字体</p>
<p class="i">斜体</p>
<style>
p.n{font-weight:normal;}
p.b{font-weight:bold;}
</style> 
<p >标准字体</p>
<p class="n">标准字体</p>
<p class="b">粗一点</p>
<style>
p.f1{font-family:"Times New Roman";}
p.f2{font-family:Arial;}
p.f3{font-family:宋体;}
p.f4{font-family:黑体;}
p.f5{font-family:楷体;}
p.f6{font-family:微软雅黑;}
</style> 
<p >默认字库 font family:default </p>
<p class="f1">设置字库 font-family: Times New Roman</p>
<p class="f2">设置字库 font-family: Arial</p>
<p class="f3">设置字库 font-family: 宋体, 这种字体是IE默认字体</p>
<p class="f4">设置字库 font-family: 黑体</p>
<p class="f5">设置字库 font-family: 楷体</p>
<p class="f6">设置字库 font-family: 微软雅黑, 这个字体是火狐默认字体</p>
<style>
p.all{font:italic bold 30px "Times New Roman";} 
</style> 
<p>默认字体</p>
<p class="all">斜体的 粗体的 大小是30px的 "Times New Roman" </p>

鼠标样式

鼠标样式

<style>
  span{
    cursor:crosshair;
  }
</style>
上一篇 下一篇

猜你喜欢

热点阅读