我正在为一个朋友创建一个网站,由于某种原因,当窗口缩小到最小尺寸以及在手机上时,文本的右侧会被截断。我已经给出了下面的代码。
他希望它出现以便固定铲子图像,但是可以从右向左滚动菜单按钮。
这是网站:http://gonetilmonday.com/
这是html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>monday sucks</title>
<link
rel="shortcut icon"
type="image/png"
href="./images/Robbie/gtmFlagLogo.JPG"
/>
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<div class="allContent">
<div class="shovel">
<div class="overlay">
<img src="./images/Robbie/stayAlive.png" alt="" class="stayAlive" />
</div>
</div>
</div>
<div class="socialMediaLinks">
<a href="https://fanlink.to/gonetilmonday">
<div class="musicLink"></div>
</a>
<a
href="https://www.youtube.com/watch?v=iZ63pdM-KfU&list=PLBj7nXLL_85nmZgnuNGctSzhGmaesPrTJ"
>
<div class="youtubeLink"></div>
</a>
<a href="mailto: gtm@usa.com">
<div class="mailLink"></div>
</a>
<a href="https://www.instagram.com/gonetilmonday/">
<div class="instaLink"></div>
</a>
<a href="https://twitter.com/_gonetilmonday">
<div class="twitterLink"></div>
</a>
</div>
</body>
</html>
这是CSS:
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
width: 100%;
padding: 0 2%;
position: relative;
font-size: 30px;
min-height: 100%;
margin: 0;
padding: 0;
}
.allContent {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.shovel {
width: 150px;
height: 331px;
display: flex;
justify-content: center;
align-items: center;
background-position: center;
background-image: url(../images/Robbie/shovel.png);
background-repeat: no-repeat;
background-size: cover;
margin-left: -95px;
margin-top: -80px;
}
.overlay {
width: 110px;
height: 331px;
position: center;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
background-image: url(../images/Robbie/stayAlive.png);
margin-left: 80px;
}
.shovel:hover .overlay {
opacity: 1;
}
.stayAlive {
width: 140px;
height: 92px;
margin-left: 160px;
}
/* Social Media */
.socialMediaLinks {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
margin-top: -120px;
}
.musicLink {
width: 98px;
height: 51px;
margin-right: 40px;
background-position: center;
background-image: url(../images/Robbie/music.png);
background-repeat: no-repeat;
background-size: cover;
}
.youtubeLink {
width: 98px;
height: 51px;
margin-right: 40px;
background-position: center;
background-image: url(../images/Robbie/youtube.png);
background-repeat: no-repeat;
background-size: cover;
}
.mailLink {
width: 98px;
height: 51px;
margin-right: 40px;
background-position: center;
background-image: url(../images/Robbie/mail.png);
background-repeat: no-repeat;
background-size: cover;
}
.instaLink {
width: 98px;
height: 51px;
margin-right: 40px;
background-position: center;
background-image: url(../images/Robbie/insta.png);
background-repeat: no-repeat;
background-size: cover;
}
.twitterLink {
width: 98px;
height: 51px;
background-position: center;
background-image: url(../images/Robbie/twitter.png);
background-repeat: no-repeat;
background-size: cover;
}
答案 0 :(得分:1)
您想要包装元素,因此将flex-wrap:wrap
添加到其容器中:
.socialMediaLinks {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
flex-wrap: wrap; /* <-- Add this line */
margin-top: -120px;
}