调整 window 大小时,我无法摆脱 html css 中的白色边框
I can't get rid of a white border in html css when resizing the window
我正在尝试为学校做一个项目,但我遇到了无法解决的问题。
当我尝试调整 windows 的大小时(顺便说一句,我正在使用 chrome,你可以在图片中看到)我得到了一个底部滚动条,它可以工作但有一点问题......背景内的文字正在脱离它,当我向右滚动时,我有一个白色边框,其中出现了文字,但背景没有展开或 idk ...
我试过:
向左飘浮;
溢出-x:隐藏; (这有效,但我不能再使用滚动条并且不会扩展我的背景,我在其他论坛上看到过这个“解决方案”)
我不知道该怎么办...请帮助我...
the picture with the code
the picture with chrome
*{
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.backgroundColor{
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #1d2026;
position: absolute;
}
h1 p{
text-align: center;
padding-top: 150px;
padding-bottom: auto;
font-size: 200px;
color: #29313f;
}
.roundBtn {
font-size: 108px;
color: #29313f;
background: #1d2026;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 0%;
border: none;
text-decoration: none;
margin-top: 50px;
margin-left: 48%;
}
h4 p{
font-size: 40px;
color: #ffff
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="backgroundColor">
<header>
<nav>
<img src="images/logoT.png" class="logoTemp">
</nav>
</header>
<h1><p>welcome</p></h1>
<a class="roundBtn" href="">
<ion-icon name="chevron-forward-sharp"></ion-icon>
<!----<h4><p>Take a look</p></h4></!---->
</a>
</div>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</body>
</html>
在 .backgroundColor
class 上使用 overflow: hidden;
。使用这种结构,您拥有的最佳解决方案是调整 h1
以使其适合移动视口。为此,我使用 media queries
更改 h1 font-size
.
*{
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.backgroundColor{
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #1d2026;
position: absolute;
overflow: hidden;
}
h1 p{
text-align: center;
padding-top: 150px;
padding-bottom: auto;
font-size: 200px;
color: #29313f;
}
.roundBtn {
font-size: 108px;
color: #29313f;
background: #1d2026;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 0%;
border: none;
text-decoration: none;
margin-top: 50px;
margin-left: 48%;
}
h4 p{
font-size: 40px;
color: #ffff
}
@media only screen and (max-width: 800px) {
h1 p {
font-size: 7rem;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="backgroundColor">
<header>
<nav>
<img src="images/logoT.png" class="logoTemp">
</nav>
</header>
<h1><p>welcome</p></h1>
<a class="roundBtn" href="">
<ion-icon name="chevron-forward-sharp"></ion-icon>
<!----<h4><p>Take a look</p></h4></!---->
</a>
</div>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</body>
</html>
显然,您可以根据需要随意调整尺寸。
我正在尝试为学校做一个项目,但我遇到了无法解决的问题。 当我尝试调整 windows 的大小时(顺便说一句,我正在使用 chrome,你可以在图片中看到)我得到了一个底部滚动条,它可以工作但有一点问题......背景内的文字正在脱离它,当我向右滚动时,我有一个白色边框,其中出现了文字,但背景没有展开或 idk ... 我试过: 向左飘浮; 溢出-x:隐藏; (这有效,但我不能再使用滚动条并且不会扩展我的背景,我在其他论坛上看到过这个“解决方案”) 我不知道该怎么办...请帮助我... the picture with the code the picture with chrome
*{
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.backgroundColor{
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #1d2026;
position: absolute;
}
h1 p{
text-align: center;
padding-top: 150px;
padding-bottom: auto;
font-size: 200px;
color: #29313f;
}
.roundBtn {
font-size: 108px;
color: #29313f;
background: #1d2026;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 0%;
border: none;
text-decoration: none;
margin-top: 50px;
margin-left: 48%;
}
h4 p{
font-size: 40px;
color: #ffff
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="backgroundColor">
<header>
<nav>
<img src="images/logoT.png" class="logoTemp">
</nav>
</header>
<h1><p>welcome</p></h1>
<a class="roundBtn" href="">
<ion-icon name="chevron-forward-sharp"></ion-icon>
<!----<h4><p>Take a look</p></h4></!---->
</a>
</div>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</body>
</html>
在 .backgroundColor
class 上使用 overflow: hidden;
。使用这种结构,您拥有的最佳解决方案是调整 h1
以使其适合移动视口。为此,我使用 media queries
更改 h1 font-size
.
*{
margin: 0;
padding: 0;
font-family: 'poppins', sans-serif;
box-sizing: border-box;
}
.backgroundColor{
background: #1d2026;
min-height: 100vh;
width: 100%;
color: #1d2026;
position: absolute;
overflow: hidden;
}
h1 p{
text-align: center;
padding-top: 150px;
padding-bottom: auto;
font-size: 200px;
color: #29313f;
}
.roundBtn {
font-size: 108px;
color: #29313f;
background: #1d2026;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 0%;
border: none;
text-decoration: none;
margin-top: 50px;
margin-left: 48%;
}
h4 p{
font-size: 40px;
color: #ffff
}
@media only screen and (max-width: 800px) {
h1 p {
font-size: 7rem;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="backgroundColor">
<header>
<nav>
<img src="images/logoT.png" class="logoTemp">
</nav>
</header>
<h1><p>welcome</p></h1>
<a class="roundBtn" href="">
<ion-icon name="chevron-forward-sharp"></ion-icon>
<!----<h4><p>Take a look</p></h4></!---->
</a>
</div>
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
</body>
</html>
显然,您可以根据需要随意调整尺寸。