我无法在css / html中调整图像大小。 这是我的代码我无法调整大小。
<!DOCTYPE html>
<html>
<head>
<title>DoYouLoveDogs</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<body>
<div id="top">
<div class="img-yes">
<img class="img-yes" src="img/yes.png">
</div>
</div>
<div id="bottom">
</div>
<script src="js/jquery.js"></script>
<script src="js/button.js"></script>
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
</body>
</html>
这是我的css:
body{
margin: 0;
}
#top{
background-color: #53FF40;
width: 100%;
height: 50%;
}
#bottom{
background-color: #FF5757;
width: 100%;
height: 50%;
}
.img-yes{
width: 25%;
height: 25%;
}
好的,就是这样。
还有一个问题我在哪里可以学习php。
我想建立一个社交网络。
答案 0 :(得分:0)
尝试图像的最小宽度和最小高度。 Div也有相同的类,所以它会产生两次。互联网上有很多在线php文档。只是“谷歌”你想要实现的目标。
答案 1 :(得分:0)
请尝试给出具有正确宽高比的绝对大小以调整大小,或者您可以使用bootstrap响应式标记img-responsive来调整基于视口的大小。
查看w3cschools的PHP教程。
答案 2 :(得分:0)
试试这个
body{
margin: 0;
}
#top{
background-color: #53FF40;
width: 100%;
height: 50%;
}
#bottom{
background-color: #FF5757;
min-width: 100%;
min-height: 50%;
}
.img-yes{
min-width: 25%;
min-height: 25%;
}
或者您可以为图像容器设置特定宽度,例如宽度:500px;