img元素应该相应地调整大小,相对于其父元素的宽度,而不超过其原始大小



这是我的代码-不是wroking-(#imgdiv中包含的#image(:

#image{
border-radius: 5px;
width: 80%;
height: 80%;
margin-left: 10%;
margin-right: 10%;
margin-top: 60px;
border-radius: 25px;}



#img-div {
background-color: #a9dce3;
width: 96%;
height: 600px;
margin-left:2%;
margin-right: 2%;
border-radius: 25px;}

我的完整代码:https://codepen.io/jozzo/pen/dyVYQWP原始任务:https://www.freecodecamp.org/learn/responsive-web-design/responsive-web-design-projects/build-a-tribute-page

如果能得到的帮助,我将不胜感激

试试这个。。。

#image{
border-radius: 5px;
width: 80%;
max-width: 1440px;
height: auto;
margin-left: 10%;
margin-right: 10%;
margin-top: 60px;
border-radius: 25px;
}

相关内容

最新更新