테스트 사이트 - 개발 중인 베타 버전입니다

미디어 쿼리 쓰려고 하는데요 채택완료

옼히나와 6년 전 조회 2,164

table에 먹여야 될 것 같은데 @media (max-width:700px){
    table{width: 700px;} }

이렇게 해도 아무 반응이 없습니다 어디에 먹여야 전체 크기를 줄여서 모바일로 볼 수 있을까요?

코드가 너무 길어서 죄송하지만.. 게시판에 포인트라도 달아놓고 싶네요ㅠㅠ

 

</p>

<p><?php

if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

include_once('./_common.php');

include_once("$board_skin_path/moonday.php"); // 석봉운님의 음력날짜 함수</p>

<p>if (preg_match('/%/', $width)) {

  $col_width = "14%"; //표의 가로 폭이 100보다 크면 픽셀값입력

} else{

  $col_width = round($width/7); //표의 가로 폭이 100보다 작거나 같으면 백분율 값을 입력

}

$col_height= 80 ;//내용 들어갈 사각공간의 세로길이를 가로 폭과 같도록

$today = getdate(); 

$b_mon = $today['mon']; 

$b_day = $today['mday']; 

$b_year = $today['year']; 

if ($year < 1) { // 오늘의 달력 일때

  $month = $b_mon;

  $mday = $b_day;

  $year = $b_year;

}</p>

<p>if(!$year)     $year = date("Y");

$file_index = $board_skin_path."/day"; ### 기념일 폴더 위치 지정</p>

<p>### 양력 기념일 파일 지정 : 해당년도 파일이 없으면 기본파일(solar.txt)을 불러온다

if(file_exists($file_index."/".$year.".txt")) {

    $dayfile = file($file_index."/".$year.".txt");

} else { 

    $dayfile = file($file_index."/solar.txt");

}</p>

<p>$lastday=array(0,31,28,31,30,31,30,31,31,30,31,30,31);

if ($year%4 == 0) $lastday[2] = 29;

$dayoftheweek = date("w", mktime (0,0,0,$month,1,$year));</p>

<p>// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨

add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0);

?>

<table width="<?php echo $width ?>" border=0 cellpadding="0" cellspacing="0">

  <tr>

       <td width="20%" class="fg_title"> </td>

       <td width="60%" height="30" align="center">

        <table border="0" cellspacing="5" cellpadding="0">

        <tr>

            <td>

            <form name="form1" style="display:inline">

                <select name="formselect1" size="1" OnChange="namosw_goto_byselect(this, 'self')" style="height:24px">

                    <option value="#">년도별검색</option>

                    <?php

                    $year_plus = $year+5 ;    

                    for( $i=$year-4 ; $i<$year_plus ; $i++ ){

                        echo "<option value=".G5_BBS_URL."/board.php?bo_table=$bo_table&year=".$i."&month=".$month.">".$i."</option>";

                    }

                    ?>

                </select>

            </form>

            </td>

            <td><a href="<?php echo $_SERVER[PHP_SELF]."?bo_table=".$bo_table."&"; ?><?php if ($month == 1) { $year_pre=$year-1; $month_pre=$month; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>"><img src="<?php echo $board_skin_url ?>/img/y_prev.gif" border="0" alt="<?php echo $year_pre ?>년"></a></td>

            <td><a href="<?php echo $_SERVER[PHP_SELF]."?bo_table=".$bo_table."&"; ?><?php if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year; $month_pre=$month-1;} echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>"><img src="<?php echo $board_skin_url ?>/img/m_prev.gif" border="0" alt="<?php echo $month_pre ?>월"></a></td>

            <td style="padding:0 10px;font-size:18px;font-weight:bold;"><a href="<?php echo $_SERVER[PHP_SELF]."?bo_table=".$bo_table; ?>" title="오늘로" onfocus="this.blur()"><?php echo $year ?>년 <?php echo $month ?>월</a></td>

            <td><a href="<?php echo $_SERVER[PHP_SELF]."?bo_table=".$bo_table."&"; ?><?php if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>"><img src="<?php echo $board_skin_url ?>/img/m_next.gif" border="0" alt="<?php echo $month_pre ?>월"></a></td>

            <td><a href="<?php echo $_SERVER[PHP_SELF]."?bo_table=".$bo_table."&"; ?><?php if ($month == 12) { $year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre&sc_no=$sc_no");?>"><img src="<?php echo $board_skin_url ?>/img/y_next.gif" border="0" alt="<?php echo $year_pre ?>년"></a></td>

            <td>

            <form name="form1" style="display:inline">

                <select name="formselect1" size="1" OnChange="namosw_goto_byselect(this, 'self')" style="height:24px">

                    <option value="#">월별검색</option>

                    <?php

                    $year_plus = $year+5 ;    

                    for( $i=1 ; $i<13 ; $i++ ){

                        echo "<option value=".G5_BBS_URL."/board.php?bo_table=$bo_table&year=".$year."&month=".$i.">".$i."</option>";

                    }

                    ?>

                </select>

            </form>

            </td>

        </tr>

        </table>            

    </td>

    <td width="20%" align="right">

        <?php if ($rss_href || $write_href) { ?>

        <ul class="btn_bo_user">

            <?php if ($rss_href) { ?><li><a href="<?php echo $rss_href ?>" class="btn_b01 btn"><i class="fa fa-rss" aria-hidden="true"></i> RSS</a></li><?php } ?>

            <?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin btn"><i class="fa fa-user-circle" aria-hidden="true"></i> 관리자</a></li><?php } ?>

            <?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02 btn"><i class="fa fa-pencil" aria-hidden="true"></i> 업무현황등록</a></li><?php } ?>

        </ul>

        <?php } ?>

</td>

  </tr>

</table></p>

<p><div id="bo_list">

<table width="<?php echo $width ?>" bgcolor="#cfcfcf" border="0" cellspacing="1" cellpadding="5">

<thead>

  <tr bgcolor="#fdfac2" align="center">     

    <th style="color:red">SUN</th>

    <th>MON</th>

    <th>TUE</th>

    <th>WED</th>

    <th>THU</th>

    <th>FRI</th>

    <th style="color:blue">SAT</th>

  </tr>

</thead>

<tbody>

<?php

$cday = 1;

$sel_mon = sprintf("%02d",$month);

    

$query = "SELECT * FROM $write_table WHERE left(wr_1,6) <= '$year$sel_mon' and left(wr_2,6) >= '$year$sel_mon' ORDER BY wr_id ASC";

$result = sql_query($query);

$j=0; // layer id

// 내용을 보여주는 부분

while ($row = sql_fetch_array($result)) {  // 제목글 뽑아서 링크 문자열 만들기..

  if( substr($row[wr_1],0,6) <  $year.$sel_mon ) {

     $start_day =1; 

     $start_day= (int)$start_day;

  } else {

     $start_day = substr($row[wr_1],6,2);

     $start_day= (int)$start_day;

  }</p>

<p>  if( substr($row[wr_2],0,6) >  $year.$sel_mon ) {

     $end_day = $lastday[$month];

     $end_day= (int)$end_day;

  } else {

     $end_day = substr($row[wr_2],6,2);

     $end_day= (int)$end_day;

  }</p>

<p>  // 아이디에 따라 다른 아이콘이미지 출력 하고 싶을때 ///주석을 해제

  $imgown = 'icon';</p>

<p>  for ($i = $start_day ; $i <= $end_day;  $i++) {</p>

<p>    if (strlen($row[wr_3]) > 0) {  // 입력된 아이콘 값이 있을 때

      $imgown = $row[wr_3] ;

    }</p>

<p>    $j++; // layer ID</p>

<p>    $list[comment_cnt] = " ".$row[wr_comment]; // row에 대하여 코멘트 카운터 정의

    if($row[wr_comment] == 0) {

      $list[comment_cnt] = null ;

    } else {

      if($list[comment_cnt]!=null) $list[comment_cnt] = "<b><font color=#ff6600>".$list[comment_cnt]."</font></b>"; 

    }</p>

<p>    $row[wr_subject] = cut_str(get_text($row[wr_subject]),$board[bo_subject_len],"…"); // subject length cut</p>

<p>    /*$list['icon_new'] = '';

    if ($row['wr_datetime'] >= date("Y-m-d H:i:s", G5_SERVER_TIME - ($board['bo_new'] * 3600)))

      $list['icon_new'] = " <img src='$board_skin_url/img/icon_new.gif' align='absmiddle' title='새글'>";*/</p>

<p>    if ($member[mb_level] < $board[bo_read_level]) {

      $showLayer="" ;

    } else { 

      $showLayer=" onmouseover=\"PopupShow('".$j."')\" onmouseout=\"PopupHide('".$j."')\" ";

    }

    $html_day[$i] .= "<div style='line-height:17px'>".$list[icon_new].$list[comment_cnt]."</div>";

    $html_day[$i] .= '<a href="'.G5_BBS_URL."/board.php?bo_table=$bo_table&year=$year&month=$month&wr_id=$row[wr_id]&sc_no=$sc_no".'" style="background-color:'.$row[wr_3].';display:block;text-align:center;font-weight:bold;"id="subject_'.$j.'"  '.$showLayer.'>';

    $html_day[$i] .= '<font color=" '.white.' "> '.$row[wr_subject].' </font>';

    $html_day[$i] .= '</a>';</p>

<p>

    if($row['wr_3']=="red") {

        $div=' stlye="background:#ff0000;"'; 

            }else if($row['wr_3']=="blue") {

        $div=' stlye="background:#2167bc"';

            }else{

        $div='';

        }

?>

    <!-- 뷰 팝업레이어 -->

    <DIV ID="popup_<?php echo $j ?>" class="popup_layer"> 

<?php

    $html = 0;

    if (strstr($row[wr_option], "html1"))

      $html = 1;

    else if (strstr($row[wr_option], "html2"))

      $html = 2;</p>

<p>      $viewlist = cut_str(conv_content($row[wr_content], $html),10000,"…");

      echo "<font color=gray>( 작성자 : ".$row['name'] = substr($row['wr_name'], 0, -3).'*'." )</font>
";

      echo $viewlist;

?>

    </DIV></p>

<p>  <? 

        //오늘 스케줄 구하기

        if ($row[wr_id] != $sc_id && date('Ymd', strtotime($row[wr_1])) <= date(Ymd) && date('Ymd', strtotime($row[wr_2])) >= date(Ymd)) {

            $today_schedule .= "<p><img src='$board_skin_url/img/".$imgown.".gif' border=0 align=absmiddle />";

            $today_schedule .= " (".substr($row['wr_1'],4,2)."/".substr($row['wr_1'],6,2)." ~ ".substr($row['wr_2'],4,2)."/".substr($row['wr_2'],6,2).")";

            $today_schedule .= " <a href='".G5_BBS_URL."/board.php?bo_table=$bo_table&year=$year&month=$month&wr_id=$row[wr_id]&sc_no=$sc_no'><font color=gray>".$row['name'] = substr($row['wr_name'], 0, -3).'*'."</font> ".$row[wr_subject]."</a> 
";

            $today_schedule .= $viewlist."<p> <p>";

        }        

        $sc_id = $row[wr_id];

    }

  }</p>

<p>

  // 달력의 틀을 보여주는 부분</p>

<p>  $temp = 7- (($lastday[$month]+$dayoftheweek)%7);</p>

<p>  if ($temp == 7) $temp = 0;

     $lastcount = $lastday[$month]+$dayoftheweek + $temp;</p>

<p>  for ($iz = 1; $iz <= $lastcount; $iz++) { // 42번을 칠하게 된다.

    $bgcolor = "#ffffff";  // 쭉 흰색으로 칠하고

    if ($b_year==$year && $b_mon==$month && $b_day==$cday) $bgcolor = "#DEFADE";      //  "#DFFDDF"; // 오늘날짜 연두색으로 표기

    if (($iz%7) == 1) echo ("<tr>"); // 주당 7개씩 한쎌씩을 쌓는다.

    if ($dayoftheweek < $iz  &&  $iz <= $lastday[$month]+$dayoftheweek)    {

    // 전체 루프안에서 숫자가 들어가는 셀들만 해당됨

    // 즉 11월 달에서 1일부터 30 일까지만 해당

    $daytext = "$cday";   // $cday 는 숫자 예> 11월달은 1~ 30일 까지

    //$daytext 은 셀에 써질 날짜 숫자 넣을 공간

    $daycontcolor = "" ; 

    $daycolor = ""; 

    if ($iz%7 == 1) $daycolor = "red"; // 일요일

    if ($iz%7 == 0) $daycolor = "blue"; // 토요일</p>

<p>    // 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고 

    // 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.

    echo ("<td width=$col_width height=$col_height bgcolor=$bgcolor valign=top>");</p>

<p>    $f_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);</p>

<p>    // 기념일 파일 내용 비교위한 변수 선언, 월과 일을 두자리 포맷으로 고정

    if (strlen($month) == 1) { 

        $monthp = "0".$month ;

    } else {

        $monthp = $month ; 

    }

    if (strlen($cday) == 1) {

        $cdayp = "0".$cday ;

    } else { 

        $cdayp = $cday ; 

    }

    $memday = $year.$monthp.$cdayp;

    $daycont = "" ;</p>

<p>    // 기념일(양력) 표시

    for($i=0 ; $i < sizeof($dayfile) ; $i++) {  // 파일 첫 행부터 끝행까지 루프

        $arrDay = explode("|", $dayfile[$i]);

        if($memday == $year.$arrDay[0]) {

            $daycont = $arrDay[1]; 

            $daycontcolor = $arrDay[2];

            if(substr($arrDay[2],0,3)=="red") $daycolor = "red"; // 공휴일은 날짜를 빨간색으로 표시

        }

    }</p>

<p>    // 석봉운님의 음력날짜 변수선언

    $myarray = soltolun($year,$month,$cday);

    if ($myarray[day]==1 || $myarray[day]==11 || $myarray[day]==21) {

      $moonday ="<font color='gray'> (음)$myarray[month].$myarray[day]$myarray[leap]</font>";

    } else {

      $moonday="";

    }</p>

<p>    include($file_index."/lunar.txt"); ### 음력 기념일 파일 지정</p>

<p>    if ($annivmoonday&&$daycont) $blank="
"; // 음력절기와 양력기념일이 동시에 있으면 한칸 띔

    else $blank="";</p>

<p>    if ($write_href) { 

      // $write_href (글쓰기 권한)이 있으면

      // 날짜를 클릭하면 글씨쓰기가 가능한 링크를 넣어서 출력하기

      echo "<a href='./board.php?bo_table=$bo_table&t=$f_date&year=$year&month=$month' title='일정보기'>※</a> </a><a href='$write_href&f_date=$f_date'><font color='$daycolor' title='일정추가'>$daytext</font></a>$moonday <font color='$daycontcolor'>$daycont</font>$blank $annivmoonday";

    } else { // 글쓰기 권한이 없으면 글쓰기 링크는 넣지 않고 그냥 숫자와 기념일 내용만 출력하기  

      echo "<a href='./board.php?bo_table=$bo_table&t=$f_date&year=$year&month=$month' title='일정보기'>※</a> <font color='$daycolor'>$daytext</font>$moonday <font color='$daycontcolor'>$daycont</font>$blank $annivmoonday";

    }

    echo $html_day[$cday];

    echo ("</td>");  // 한칸을 마무리

    $cday++; // 날짜를 카운팅

  } 

  // 유효날짜가 아니면 그냥 회색을 칠한다.

  else { echo ("     <td width=$col_width height=$col_height bgcolor=f9fafe valign=top> </td>"); }

  if (($iz%7) == 0) echo ("  </tr>");

   

} // 반복구문이 끝남

?>

</tbody>

</table>

</div>

<p> <p>

<table cellpadding='0' cellspacing='0' width="100%" style="border:1px solid #CCC;">

    <tr style="border-bottom:1px solid #CCC;" align="center">

        <td style="background-color:#EFEFEF;border-right:1px solid #CCC;" width="30" height="32"><b>번호</b></td>

        <td style="background-color:#EFEFEF;border-right:1px solid #CCC;" align="center"><b><?php echo $t; ?> 일정목록</b></td>

    </tr>

    <?php

        //$sql = " select wr_subject, wr_5, wr_link2, wr_id, wr_2 from g5_write_{$bo_table} where wr_1 = '{$t}' or (wr_1 <= '{$t}' and wr_2 >= '{$t}') order by wr_id desc ";    </p>

<p>          $sql = " select wr_subject, wr_5, wr_link2, wr_id, wr_name, wr_1, wr_2, wr_content from g5_write_{$bo_table} where {$t} between wr_1 and wr_2 order by wr_id asc ";    </p>

<p>

        //echo $sql;

        $result = sql_query($sql);

        for ($i=0; $row=sql_fetch_array($result); $i++) {

            $wr_5 = @explode(" ",$row['wr_5']);

            $k = $i+1;</p>

<p>

            /*

            if($row[wr_link2] == "1") {

                $wr_link2 = "계약";

            } else if($row[wr_link2] == "3") {

                $wr_link2 = "가입";

            } else if($row[wr_link2] == "2") {

                $wr_link2 = "세팅";

            } else if($row[wr_link2] == "4") {

                $wr_link2 = "출고";

            } else if($row[wr_link2] == "5") {

                $wr_link2 = "설치";

            }

            */

            

    ?>

    

    <tr>

        <td style="border-right:1px solid #CCC;border-top:1px solid #CCC;" height="35" align="center"><?php echo $i+1; ?></td>

        <td style="border-right:1px solid #CCC;border-top:1px solid #CCC;padding:15px;"> <? echo "".substr($row['wr_1'],4,2)."/".substr($row['wr_1'],6,2) ?><!-- ~ <? echo "".substr($row['wr_2'],4,2)."/".substr($row['wr_2'],6,2) ?>)--> <a href="<?php echo G5_BBS_URL;?>/board.php?bo_table=<?php echo $bo_table;?>&wr_id=<?php echo $row[wr_id];?>"><!--<? echo $row['name'] = substr($row['wr_name'], 0, -3).'*'; ?>--> <?php echo $row[wr_subject]; ?><p>

<font color=gray><?php echo nl2br($row[wr_content]); ?></font></a></p>

<p>        <!--

        <? echo $html_day[$i].= "<a href='".G5_BBS_URL."/board.php?bo_table=$bo_table&year=$year&month=$month&wr_id=$row[wr_id]&sc_no=$sc_no' id='subject_".$j."'>".$row[wr_subject]."</a>";

        ?>

        -->

        </td>

    </tr>

    <?php

        }

        if(!$i) {

    ?>

    <tr style="border-bottom:1px solid #CCC;">

        <td colspan="2" style="border-right:1px solid #CCC;border-top:1px solid #CCC;" height="45" align="left"> 선택된 일정이 없습니다. 날짜 옆 ※를 클릭해 주세요.</td>

    </tr>

    <?php

        }

    ?>

</table></p>

<p><!--<center><? include ("../event.php"); ?></center>--></p>

<p><script language="JavaScript">

// 년, 월 form 스크립트

function namosw_goto_byselect(sel, targetstr)

{

  var index = sel.selectedIndex;

  if (sel.options[index].value != '') {

     if (targetstr == 'blank') {

       window.open(sel.options[index].value, 'win1');

     } else {

       var frameobj;

       if (targetstr == '') targetstr = 'self';

       if ((frameobj = eval(targetstr)) != null)

         frameobj.location = sel.options[index].value;

     }

  }

}</p>

<p><!--

// 미리보기 팝업 보이기

function PopupShow(n) {

    var position = $("#subject_"+n).position(); 

    $("#popup_"+n).animate({left:position.left-10+"px", top:position.top+30+"px"},0);

    $("#popup_"+n).show();

}</p>

<p>// 미리보기 팝업 숨기기

function PopupHide(n) {

    $("#popup_"+n).hide();

}

//-->

</script>

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

답변 3개

채택된 답변
+20 포인트

table width를 100%로 잡고, 내부 td를 열 수에 맞게 %로 나눠서 적용해보세요.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

옼히나와
6년 전
시도해보겠습니다!

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

아르키어드

대댓글은 이미지첨부가안되서..지금 head에도 viewport도 없습니다

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

옼히나와
6년 전
감사합니다 밑에 저게 viewport인줄 알았는데 아니군요 내일 포함시켜서 시도해보겠습니다!
옼히나와
6년 전
<meta name="viewport" content="width=device-width, initial-scale=1.0">

head.sub에 위 코드를 삽입했는데도 그대로입니다 ㅠㅠ

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

아르키어드

일단 그전에 head.sub.php에 viewport 메타태그가 있는지 아니면 개발자도구로 elements에서 viewport가 있는지 먼저 확인해보세요

로그인 후 평가할 수 있습니다

답변에 대한 댓글 5개

옼히나와
6년 전
echo '<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10,user-scalable=yes">'.PHP_EOL;
이렇게 있습니다!
아르키어드
6년 전
작업중인 url좌표라도 찍어주시면 개발자도구창 열어서 좀더 쉽게 볼거같은데요.. 개발자도구에서도 확인해보셨나요?
옼히나와
6년 전
http://www.etj.co.kr/bbs/board.php?bo_table=test
여기입니다!
아르키어드
6년 전
class fg_title인얘하고 그및에 있는 width 20%짜리 td는 뭐하는데 사용하시는건가여?
옼히나와
6년 전
아마도 저 달력 만드셨던 분이 정렬은 따로 안 하고 왼쪽에서 그냥 빈공간으로 민 것 같습니다!

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

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

로그인