简体   繁体   English

如何在网络应用程序中加入换行符? (HTML,CSS)

[英]How do I incorperate a line break in a web app? (HTML,CSS)

So I have been researching this for the past 10 or so minutes and am now bringing it to this community. 因此,过去十分钟左右,我一直在对此进行研究,现在将其带入这个社区。 I don't know how to make a break like this: 我不知道该如何休息: 中间带有“或”的换行符。

I know there used to be an "hr" tag like so, 我知道曾经有一个像这样的“ hr”标签,


but its depreciated and I'd prefer to use something else. 但它已经贬值了,我更喜欢使用其他东西。 Its a common thing for login pages where its Email login "or" login with a social account. 对于登录页面,这是很常见的,其电子邮件登录“或”使用社交帐户登录。 If you have any tips or find anything, please link it down below! 如果您有任何提示或发现什么,请在下面将其链接!

Thanks in advance!! 提前致谢!!

The <hr> is not deprecated. 不建议使用<hr>

In HTML5, the <hr> tag defines a thematic break. 在HTML5中, <hr>标记定义主题中断。

In HTML 4.01, the <hr> tag represents a horizontal rule. 在HTML 4.01中, <hr>标记表示水平线。

However, the <hr> tag may still be displayed as a horizontal rule in visual browsers, but is now defined in semantic terms, rather than presentational terms. 但是, <hr>标记仍可以在视觉浏览器中显示为水平规则,但现在是用语义术语而不是表示性术语定义的。

All the layout attributes are removed in HTML5. HTML5中删除了所有布局属性。 Use CSS instead. 改用CSS。

For more check https://www.w3schools.com/tag_hr . 有关更多信息,请访问https://www.w3schools.com/tag_hr

An alternative would be to use for example <div>s and borders (check the snippet): 一种替代方法是使用例如<div>sborders (检查代码段):

 .thisIsFormContainer { position:relative; float:left; border:1px solid #000; border-radius:4px; text-align:center; padding:20px; } .top { position:relative; width:90%; margin:0px auto 10px auto; padding:0; border-bottom:1px solid #09f; } .fieldGroup { position:relative; width:90%; margin:0px auto 0px auto; padding:0; text-align:left; } .item { position:relative; } 
 <div class="thisIsFormContainer"> <div class="top"> <div class="item">Send us an email!</div> </div> <div class="fieldGroup"> <div class="item">Address:</div> <div class="item">Country:</div> </div> <div class="fieldGroup"> <div class="item">State:</div> <div class="item">City:</div> </div> </div> 

I personally would use an HR with confidence, but if I didn't want to use HRs I'd try something like this, using the :after selector . 我个人会很有信心地使用HR,但是如果我不想使用HR,则可以使用:after选择器尝试类似的操作。

 p { text-align: center; } p span { background-color: #fff; display: inline-block; padding: 0 3px; } p:after { content: ''; display: block; border-bottom: 1px solid black; margin-top: -8px; } 
 <p><span>or</span></p> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM