[英]How do i make a centered “block of text”
this is HTML and CSS.这是 HTML 和 CSS。
this is my code:这是我的代码:
p {
color: white;
text-align: center;
font-family: Helvetica;
}
with the correct paragraph syntax infront of this text and after this text: its glitching on stackoverflow for me idk y (im talking about the text under this line)在此文本前面和此文本之后使用正确的段落语法:它在 stackoverflow 上的故障对我来说是 idk y(我在谈论此行下的文本)
the upper image is how i want it to be and the lower image is how it currently is上图是我想要的样子,下图是现在的样子
you have to assign a width to your paragraph.您必须为段落分配宽度。 then add margin: auto;
然后添加边距:自动;
p {
color: white;
text-align: center;
font-family: Helvetica;
background-color: black;
width:35%;
margin:0 auto;
padding:15px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.