我正在处理一个设置了两列的网页。我把所有东西都分成两列,每列都有一个容器。我正在尝试移动包含 h1 标题的 div。它位于 position: relative 位置,我正在尝试根据百分比移动它,因此当浏览器调整大小时它仍然看起来不错。我可以按百分比向左/向右移动,但我无法移动顶部或底部。它适用于 px 但当浏览器调整大小时会弄乱。我做错了什么,我需要做什么才能以最高百分比移动它?
这是 html(它实际上不是在一行中,但出于某种原因它不想以实际的方式进入此处):
<div class = "aboutuscontainer2"> <a href="http://s1379.photobucket.com/user/Staroson/media/image1_zpsd2ppwgmq.jpg.html" target="_blank"><img id = "pic" src="http://i1379.photobucket.com/albums/ah138/Staroson/image1_zpsd2ppwgmq.jpg" border="0" alt=" photo image1_zpsd2ppwgmq.jpg"/></a><div class = "developerhead"><h1> Meet the developer:</h1></div></div></div>
这是CSS:
.aboutuscontainer2 {
position: relative;
float: right;
top: 60px;
right: 0%;
border: solid white 1px;
width: 47.3%;
min-height: 100%;
overflow: hidden;
}
#pic {
position: relative;
left: 67%;
top: 2px;
width: 32%;
}
.developerhead {
position: relative;
color: yellow;
top: 0%;
left: 10%;
}
最佳答案
这是因为容器/列没有设置高度。顶部百分比基于容器,并且容器没有设置高度。
关于html - 无法移动带有百分比的 div 最高值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34440628/