<?php
for($i=0; $i< 2; $i++) {
echo '
<div class="col-lg-3 col-md-6 col-sm-12">
<a class="cl" href="/index.php/user">
<div class="card__item one">
<div class="card" style="width: 18rem;">
<div class="card-body" style="margin-top:-40px;">
<h5 class="text-center fw-bolder">제목</h5>
<div class="d-flex align-items-center justify-content-center text-dark">
<div class="mr-sm-2 fw-light">by</div>
<a href="/index.php/profile">
프로필
</a>
</div>
<p class="card-text">Some quick example text to build on the card title and make up
the bulk of the card\'s content.</p>
</div>
</div>
</div>
</a>
</div>
';
}
?>
위 처럼 딱 한번만 감싸서 만들었는데, 그 아래에 img태그 바로 위에
동일한 a태그 class='cl'이 생성되면서 감싸버리는 문제가 발생합니다.
뭐가 문제라서 이렇게 생성되는 걸까요?
한대승(불의회상) // 하단에 해당 부분을 이미지로 넣어놨습니다.
왜 이렇게 스스로 생성되는지 몰라서 헤매고 있습니다.
테러보이 // 네 맞습니다.
div태그를 전체 클릭하면 a로 이동하고, 해당 text를 클릭시 b로 이동해야할 필요가 있어서요.
text의 a를 제거하면 정상적으로 변하네요.