채택완료

최신글 썸네일 반응형으로 어떻게 해야할까요?

2020-12-24 (목) 18:30:18 3,092

아래와같이 최신글로 갤러리 썸네일을 불러옵니다.

이게 반응형일때 정사각형으로 움직여야하는데 

아래 php로 가로세로가 잡혀있어서

수정을 어떻게 해야할지 모르겠습니다.. 

%는 안먹고, 110으로 고정하자니 스크린이 커지면 정렬이 흐트러지고.. 

아래 소스에서 수정을 하려면 어떻게 해야할지 여쭤봅니다.. 

<?

if (!$width) $width = 110;
if (!$height) $height = 110;

?>

<div class="la_review">

<?
    $indexNum = 0;
    for ($i=0; $i<count($list); $i++) {
        $indexNum ++;
        $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $width, $height);
        $list[$i]['name'] = mb_substr($list[$i]['wr_name'], 0, -3).'**';


        $listHtml_s .= "
        <div class='over_cope_story' id='over_story".$indexNum."'>
        ";
    

        $listHtml_s .= "
        <div id='latast_main'>
            <a href='".$list[$i]['href']."'>
                <img src='".$thumb['src']."' >
            </a>
        </div>
        <div id='latast_main_on'>".$list[$i]['name']."님</div>        
        ";
    
        $listHtml_s .= "
        </div>
        ";
    }
    echo $listHtml_s;
    if (count($list) == 0) { //게시물이 없을 때
            echo "<div style='font-size:23px;  color:#696969; text-align:center;'>게시물이 없습니다.</div>";
    }
    ?>

답변 2개

채택된 답변
+20 포인트

사이즈가 있더라도 css 에서 사이즈를 주면 됩니다.

@media ( max-width: 768px ) {

   #latast_main img { width:100%; height:auto; }

}

위 크기 관련 설정코드 모두 제거하시고,

해당 요소에 선택자 하나 추가 후 별도로 CSS 주시면 되세요.

답변을 작성하려면 로그인이 필요합니다.