이 코드는 여러 기사에 사용되었으며 스타일 position : relative
및 id를 추가하여 기사 내부의 이미지 중 하나에 대해 하나의 특수 스타일을 추가하려고 할 때를 제외하고는 잘 작동한다고 생각합니다. = "target"
하지만 이미지 width가 0으로 줄어들거나 사라지면 여기서 어떤 종류의 실수를했는지 알 수 없습니다. 조언하십시오.
position : relative
및 id = "target"
을 제거하고 코드가 어떻게 작동하는지 확인하십시오.
jQuery 또는 JS를 사용하여 해당 개념을 달성하는 더 나은 접근 방식이 있더라도 공유하십시오.
.article {
border: 1px solid red;
padding: 0;
display: flex;
}
.article-content {
border: 1px solid black;
width: 46.66%;
text-align: left;
align-self: center;
margin-left: auto;
}
.img-control {
border:1px solid black;
max-width: 53.66%;
margin-right: auto;
margin-left: 1rem;
overflow: hidden;
}
.image {
width: auto;
width:100%;
}
.img-control img {
display: block;
max-width: 100%;
width: auto;
}
img #target {
transform: scale(2.2) translate(-35%, 29%) rotate(-25deg);
width: 670px;
display: block;
position: absolute;
}
@media only screen and (max-width:480px) {
.article {
flex-flow: wrap column;
}
.article-content, .img-control {
margin: 0 auto;
}
}
<div class="article">
<div class="article-content">
<h3 class="mainTitle">What is Lorem Ipsum?</h3>
<h5 class="subTitle">Lorem Ipsum</h5>
<p> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
<div class="img-control" style="position: relative;">
<div class="image">
<img src="http://via.placeholder.com/466x585" width="100%" alt="" style="width: 670px;right: -48px;top: -18px; display: block;position: absolute;" id="target" />
</div>
</div>
</div>