用css 如何设置页面居左代码如下/* 1. ++++++++++++++++ RESET ++ */css_html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{font-size:100%;vertical-align:baseline;border:0;outline:0;background:transparent;margin:0;padding:0}ol,ul{list-style:none}blockquote,q{quotes:none}:focus{outline:0}table{border-collapse:collapse;border-spacing:0}br.clear{clear:both}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-block}* html .clearfix{height:1%}img#wpstats{width:0;height:0;overflow:hidden}.hide,hr{display:none}/* 2. ++++++++++++++++ TEXT ++ */body{font:12px/1.5 Georgia,Baskerville,Palatino,Times;;background: #fff; color:#696969; border-top:9px solid #e7e4e1;}
用css 设置页面居左,首先我们需要写好一个div然后设置好它的宽高,然后在使用margin来操作,使它距离浏览器的左边为0就行了,marign的用法如图:
添加一个border方便观察,具体看代码:
<html>
<head>
<style>
.div1{
width:600px;
height:200px;
font-size:13px;
border:1px solid #f00;
margin:0px;
}
</head>
<body>
<div class='div1'>
<p>我是测试文字</p>
</div>
</body>
</html>
/*------全局------*/
body,hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td,label{margin:0; padding:0;}
body{font:12px/1.5 tahoma, arial, \5b8b\4f53;}
h1, h2, h3, h4, h5, h6{ font-size:12px; font-weight:normal;}
ul, ol{list-style:none;}
a{ text-decoration:none;}
fieldset, img {border:none;}
.clear{ clear:both;}
浮动居左float:left;
内容居左text-align:left;本回答被提问者采纳