如何调整水平尺元素的宽度 [英] How to adjust the width of a horizontal rule element

查看:38
本文介绍了如何调整水平尺元素的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置< hr> 元素的宽度时遇到问题.我的意思是我希望我的< hr> 像这样的图像显示为全宽度的一半:

I've got a problem with setting the width of <hr> elements. I mean I want my <hr> to be displayed half of the full width like this image:

您可以看到< hr> 元素位于< h1> 标记和段落之间,并且是屏幕全宽的一半.

As you can see the <hr> element is between the <h1> tag and paragraph and it's half of screen full width.

我已经搜索过,而我所要做的就是像这样设置< hr> 元素:

I have searched and all I got was to setting the <hr> element like this:

<hr size="30">

但是那是行不通的.那么您知道如何设置< hr> 元素的宽度吗?

But that just does not work. So do you know how to set the width of <hr> element?

推荐答案

设置CSS中hr元素的样式属性

Set the style attributes of the hr element in css

hr {
    width:50%;
    margin:0 auto;
}

这篇关于如何调整水平尺元素的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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