css里怎么让input全靠左啊

html-css010

css里怎么让input全靠左啊,第1张

css里让input全靠左,首先我们需要获取到所有的input元素,可以通过给他们加id,class实现,当然最好的是通过标签选择器,将所有的input获取,然后在通过一个flaot:left就能实现input全靠左,请看代码:

<html>

<head>

<style>

input{

width:300px

height:30px

font-size:13px

float:left

}

</head>

<body>

<div>

<input

type='submit'

value='人人'>

<input

type='button'

value='百度'>

<input

type='text'

value='订单'>

</div>

</body>

</html>

比如box是一个div,如下示例:

.box{

float:left}//向左浮动显示了

.box{float:right}//向右浮动显示了

.box{width:980px

margin:0px

auto}//居中显示了

.box{margin-top:5pxmargin-bottom:5pxmargin-left:5pxmargin-right:5pxpadding-left:5px}这个前面的分别是外面距,距上,下,左,右,后面是内边距距左,其它的也一样子的道理

在HTML调用有两种方法,第一种,直接把这个写在html的head文件里面,

在这里是CSS代码

,或者直接建CSS文件,把代码写里面,在HTML引入,