给出DIV上方和下方的空间 [英] give space above and below a DIV

查看:104
本文介绍了给出DIV上方和下方的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我如何使用CSS做这个?



我的DIV代码是:

 < div class =input> 
< label for =pseudo> choisir un pseudo *:< / label>
< br>
< input type =textname =pseudo>
< / div>


解决方案

您使用CSS padding 属性 。在你的情况下,你可能想单独使用 padding-top padding-bottom



语法如下:

  padding: 

  padding:vertical horizo​​ntal; 

一些示例:

  //这将设置顶部空间为1px,右边2px底部到3px 
//和左边4px
.input {
padding:1px 2px 3px 4px;
}

//这将设置顶部和底部为20px,右侧和
//左侧为10px;
.input {
padding:20px 10px;
}

//这将只设置底部空间,留下一切
//自动确定
.input {
padding-bottom :20px;
}

详细了解 HTML框模型


I want to give a DIV space above and under its content.

How can I do this using CSS?

my DIV code is:

<div class="input">
    <label for="pseudo">choisir un pseudo*:</label>
    <br>
    <input type="text" name="pseudo">
</div>

解决方案

You use the CSS padding property. In your case you might want to use padding-topand padding-bottom alone.

The syntax is the following:

padding: top right bottom left;

or

padding: vertical horizontal;

Some examples:

// This will set the top space to 1px, the right to 2px the bottom to 3px
// and the left to 4px
.input {
    padding: 1px 2px 3px 4px;
}

// This will set both the top and the bottom to 20px and the right and the
// left to 10px;
.input {
    padding: 20px 10px;
}

// This will set only the bottom space, leaving everything else
// to be automatically determined
.input {
    padding-bottom: 20px;
}

Read more about the HTML Box Model

这篇关于给出DIV上方和下方的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆