我在标题的两边都有几行,当我调整到移动视图的大小时,标题右侧的行从页面溢出,并增加了空白宽度的页面宽度。有什么办法可以防止这种情况的发生,或者有什么办法可以使这些响应速度更快?谢谢
html, body {
margin: 0 auto;
width: 100%;
font-family: Barlow, Arial, Helvetica, sans-serif;
font-weight: 300;
}
.container {
height:100vh;
padding: 0px 15px 0 15px;
}
#index {
box-shadow:inset 0 0 0 2000px rgba(0, 0, 0, 0.4);
text-transform: uppercase;
font-size: 36px;
color: #eeeeee;
}
#desktop-navbar {
text-transform: uppercase;
width: 100%;
height: 50px;
position: fixed;
z-index:1;
margin-top: 15px;
}
#nav-container {
display: flex;
justify-content: center;
flex-direction: column;
text-align: center;
}
#nav-container ul {
padding-left: 0;
}
#desktop-navbar li {
display: inline-block;
padding-left: 25px;
font-family: Barlow, Arial, Helvetica, sans-serif;
font-weight: 300;
letter-spacing: 2.5px;
}
#desktop-navbar li a {
text-decoration: none;
color: #ffffff;
}
#mobile-nav-container {
display: none;
}
#index p {
margin: 0;
}
#index span {
font-size: 84px;
}
.center {
display: flex;
justify-content: center;
flex-direction: column;
text-align: center;
height: 100%;
}
#main > span{
position: relative;
display: inline-block;
}
#main > span:before, #main > span:after{
content: '';
position: absolute;
top: 50%;
height: 5px;
border-bottom: 2px solid;
width: 35%; /* half of limiter*/
}
#main > span:before{
right: 100%;
margin-right: 15px;
}
#main > span:after{
left: 100%;
margin-left: 15px;
}
@media only screen and (max-width: 1280px) {
#index {
font-size: 28px;
}
#index span {
font-size: 72px;
}
}
@media only screen and (max-width: 992px) {
#index {
font-size: 22px;
}
#index span {
font-size: 62px;
}
}
@media only screen and (max-width: 810px) {
#index {
font-size: 22px;
}
#index span {
font-size: 62px;
}
}
@media only screen and (max-width: 690px) {
#nav-container {
display: flex;
justify-content: center;
flex-direction: column;
text-align: right;
}
#desktop-nav {
display: none;
}
#mobile-nav-container {
display: block;
margin-right: 25px;
}
}
@media only screen and (max-width: 320px) {
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Joshua Evans</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Barlow:300,400&display=swap" rel="stylesheet">
</head>
<body>
<div id="desktop-navbar">
<div id="nav-container">
<ul id="desktop-nav">
<li class="desktop-items"><a href="#home">Home</a></li>
<li class="desktop-items"><a href="#about">About</a></li>
<li class="desktop-items"><a href="#services">Soundtracks</a></li>
<li class="desktop-items"><a href="#gallery">Credits</a></li>
<li class="desktop-items"><a href="#contact">Contact</a></li>
</ul>
<ul id="mobile-nav-container">
<li id="mobile-menu"><a href="#contact">Menu</a></li>
</ul>
</div>
</div>
<div id="index" class="container">
<div class="center">
<p id="main"><span>Joshua Evans</span></p>
<p>Composer</p>
</div>
</div>
</body>
</html>