一些常用的html/CSS效果---小技巧

这篇博客分享了一些常用的HTML/CSS效果和技巧,包括使用reset.css进行样式重置,实现等高布局的margin应用,解决IE7及以下浏览器的垂直居中问题,背景透明但文字不透明的样式,宽高不固定div的水平垂直居中,以及如何截取指定长度的字符。此外,还介绍了如何在英文单词和数字间断行,以及利用border创建CSS小三角效果,但最后一种效果不兼容IE6/7。
摘要由CSDN通过智能技术生成

我常用的重置样式表reset.css

/*===============基础信息================*/

*{border: 0;padding: 0;margin: 0;}	
table {border-collapse:collapse;border-spacing:0;}	
ol,ul {list-style:none;}
h1,h2,h3,h4,h5,h6 {font-size:100%;}
q:before,q:after {content:''}
input,textarea,select {font-family:inherit;font-size:inherit;font-weight:inherit}
input,textarea,select {*font-size:100%}
:focus {outline: 0;}
body {line-height: 1.5; font-family:  arial, Helvetica, sans-serif; color: #2a2b2b;font-size: 14px;background: #f1f1f1;}
a,button{cursor:pointer;}
html button::-moz-focus-inner{border-color:transparent!important;} 
a{outline:none; text-decoration:none;transition: all 0.4s ease-out 0s;}
a:hover{transition: all 0.4s ease-out 0s; text-decoration:none;}
*{word-wrap:0.01em;}
img{vertical-align:top; display: inline-block;} 
i, b, em { font-style:normal;}
/*=================功能===============*/
.clearfix{ clear:both; height:0px; font-size: 1px; line-height: 0px;overflow:hidden; }/* 清除浮动*/
.left{ float: left;} .right{ float: right;} .center{ margin:0 auto; text-align:center;}
.show{ display:block;/* visibility:visible;*/}.hide{ display: none;/* visibility:hidden;*/}
.block{ display:block;} .inline{ display:inline;}

margin应用-等高布局

兼容IE6

主要样式

padding-bottom:10000px;margin-bottom:-10000px;

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
body{margin:0;}
.wrap{ width:900px;margin:0 auto;overflow:hidden;}
.left{width:200px;background:Red;float:left;padding-bottom:10000px;margin-bottom:-10000px;}
.right{width:700px;background:blue;float:right;padding-bottom:10000px;margin-bottom:-10000px;}
</style>
</head>
<body>
<div class="wrap">
	<div class="left">
    	  页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
    </div>
    <div class="right">
    	  页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<br/>
          页面内容<b
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值