HTML/CSS 定位问题/Divs 碰撞
HTML/CSS Positioning Problem / Divs Colliding
我已经尝试解决这个问题 4 个多小时了,但它变得非常令人沮丧,我是 HTML/CSS 的初学者,非常感谢您的帮助!
目标:将“.menuButton”放在左下角+确保图标实际显示
请记住,代码在我这边运行得更好,所有内容都正确定位+社交图标确实显示,我唯一的问题是将 .menuButton 放在左下角,因为我不完全确定为什么定位这么差
P.S 这不是像尝试不同的显示那样简单的修复:选项、定位或更改边距,相信我,我几乎尝试了所有方法 |还要确保背景没有问题
P.S2 为了更好地解释代码,请检查代码笔并在那里测试你的答案
https://codepen.io/jonathanz-10/pen/mdMLpXp
CSS:
body,
html {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Helvetica', sans-serif;
background: -webkit-linear-gradient(-45deg, rgba(26, 188, 156, 1) 0%, rgba(142, 68, 173, 1) 100%);
}
h1 {
font-size: 24px;
margin: 10px 0 0 0;
font-weight: lighter;
text-transform: uppercase;
color: #eeeeee;
}
p {
font-size: 12px;
font-weight: light;
color: #333333;
}
span a {
font-size: 18px;
color: #cccccc;
text-decoration: none;
margin: 0 10px;
transition: all 0.4s ease-in-out;
&:hover {
color: #ffffff;
}
}
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
transform: translatey(-20px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
}
}
.container {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.avatar {
background: url("https://jonathanz-10.github.io/Website/images/avatar.png");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 150px;
height: 150px;
box-sizing: content-box;
border: 5px white solid;
border-radius: 50%;
overflow: hidden;
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
animation: float 6s ease-in-out infinite;
}
.content {
width: 100%;
max-width: 600px;
padding: 20px 40px;
box-sizing: border-box;
text-align: center;
}
.menuButton{
bottom: 0;
left: 0;
height: 200px;
width: 200px;
display: inline-block;
text-align: center;
border: 2px solid red;
background-repeat: no-repeat;
background-image: url("https://jonathanz-10.github.io/Website/images/avatar.png");
}
<script src="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"></script>
<div class="container">
<div class="avatar"></div>
<div class="content">
<h1>JZ</h1>
<p>Follow me on:</p>
<p>
<span><a href="https://twitter.com/" target="_blank"><i class="fa fa-twitter"></i></a></span>
<span><a href="https://github.com/" target="_blank"><i class="fa fa-github"></i></a></span>
<span><a href="https://www.linkedin.com/in/" target="_blank"><i class="fa fa-linkedin"></i></a></span>
<span><a href="https://codepen.io/" target="_blank"><i class="fa fa-codepen"></i></a></span>
</p>
<p>For more information scroll down</p>
</div>
</div>
<div class="menuButtton">hi</div>
class 属性中有错字 ;)
改变
<div class="menuButtton">hi</div>
至
<div class="menuButton">hi</div>
我已经尝试解决这个问题 4 个多小时了,但它变得非常令人沮丧,我是 HTML/CSS 的初学者,非常感谢您的帮助!
目标:将“.menuButton”放在左下角+确保图标实际显示
请记住,代码在我这边运行得更好,所有内容都正确定位+社交图标确实显示,我唯一的问题是将 .menuButton 放在左下角,因为我不完全确定为什么定位这么差
P.S 这不是像尝试不同的显示那样简单的修复:选项、定位或更改边距,相信我,我几乎尝试了所有方法 |还要确保背景没有问题
P.S2 为了更好地解释代码,请检查代码笔并在那里测试你的答案
https://codepen.io/jonathanz-10/pen/mdMLpXp
CSS:
body,
html {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Helvetica', sans-serif;
background: -webkit-linear-gradient(-45deg, rgba(26, 188, 156, 1) 0%, rgba(142, 68, 173, 1) 100%);
}
h1 {
font-size: 24px;
margin: 10px 0 0 0;
font-weight: lighter;
text-transform: uppercase;
color: #eeeeee;
}
p {
font-size: 12px;
font-weight: light;
color: #333333;
}
span a {
font-size: 18px;
color: #cccccc;
text-decoration: none;
margin: 0 10px;
transition: all 0.4s ease-in-out;
&:hover {
color: #ffffff;
}
}
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
transform: translatey(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
transform: translatey(-20px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
}
}
.container {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.avatar {
background: url("https://jonathanz-10.github.io/Website/images/avatar.png");
background-repeat: no-repeat;
background-size: 100% 100%;
width: 150px;
height: 150px;
box-sizing: content-box;
border: 5px white solid;
border-radius: 50%;
overflow: hidden;
box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
animation: float 6s ease-in-out infinite;
}
.content {
width: 100%;
max-width: 600px;
padding: 20px 40px;
box-sizing: border-box;
text-align: center;
}
.menuButton{
bottom: 0;
left: 0;
height: 200px;
width: 200px;
display: inline-block;
text-align: center;
border: 2px solid red;
background-repeat: no-repeat;
background-image: url("https://jonathanz-10.github.io/Website/images/avatar.png");
}
<script src="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"></script>
<div class="container">
<div class="avatar"></div>
<div class="content">
<h1>JZ</h1>
<p>Follow me on:</p>
<p>
<span><a href="https://twitter.com/" target="_blank"><i class="fa fa-twitter"></i></a></span>
<span><a href="https://github.com/" target="_blank"><i class="fa fa-github"></i></a></span>
<span><a href="https://www.linkedin.com/in/" target="_blank"><i class="fa fa-linkedin"></i></a></span>
<span><a href="https://codepen.io/" target="_blank"><i class="fa fa-codepen"></i></a></span>
</p>
<p>For more information scroll down</p>
</div>
</div>
<div class="menuButtton">hi</div>
class 属性中有错字 ;)
改变
<div class="menuButtton">hi</div>
至
<div class="menuButton">hi</div>