首页 > 解决方案 > 如何在站点中间居中文本并删除滚动条?

问题描述

我需要这个文本在网站的中心,但它是对齐的。

<!DOCTYPE html>
<style>

::selection { opacity:.1; background:rgba(255, 255, 255,0.3) }

body {
background-color:#9999ff;
color:white;
font-family:arial;
font-size:100px;
font-weight:;
}

div.container4 {
height: 10em;
position: relative }
div.container4 p {
margin: 0;

position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%) }
}

</style>

<div class=container4>
  <p><font style="font-weight:bold;">Project</font> Lavender<br><font style="font-size:60px;">Coming 2019
</div>

当我使用它时,会出现一个滚动条。我不想只是将它删除,而是让它无论如何都不会出现。下面是滚动条的 图片 在此处输入图片说明

标签: csscenter

解决方案


只需将其添加到正文中:

overflow: hidden;

推荐阅读