html
  • css
  • 2013-09-05 3 views 0 likes 
    0

    이 두 상자를 옆에 나란히 정렬하려고합니다. 그러나 계속 생성하는 모든 것은 가운데에있는 두 개의 상자입니다 텍스트가 입력 될 때 다른 상자가 축소됩니다. 테이블은 페이지의 PHP 섹션에 있습니다.페이지 상단에있는 두 테이블을 서로 나란히 정렬하는 방법

    echo "<table style='width:100%;'><tr><td>"; 
    echo "<div style='min-height:500px;margin-top: 10px;'><table style='-moz-border-radius: 15px;border-radius: 15px;border-bottom:1px solid gray;align: left;float: left;background- color:white;margin: auto;width: 75%;'><tr style='font-weight:bold;'><td></td><td>Title</td> <td>Date</td><td>City</td></tr>"; 
    //header('Content-type: text/html; charset=utf-8'); 
    //print_r(mysql_fetch_array($result)); 
    while($row = mysql_fetch_array($result)) 
    { 
    $abcd = $row['fname']; 
    echo "<tr><td><img src='../login/image/".$row['name']."' style='width: 125px;height: 94px;'></td>"; 
    echo '<td><form action="deals.php" method="get" style="margin:0px;"><input type="hidden" value="'; 
    echo $abcd; 
    echo '" name="name"><input type="submit" style="background-color: white;border: none;color: #FF0000;text-decoration: underline;" name="submit2" value="'; 
    echo $abcd; 
    echo '"></form><br/>'; 
    echo "</td><td>".$row['stdate']."</td>"; 
    echo "</td><td>".$row['city']."</td></tr>"; 
    $y++; 
    } 
    echo "</table></div>"; 
    echo "</td><td>"; 
    echo "<div style='-moz-border-radius: 15px;border-radius: 15px;height:10%;width: 50%;padding: 30px;background-color:white;align: right;float: right;margin: auto;margin-top:5px;'>"; 
    echo "</td></table>"; 
    
    +1

    왜 모든 HTML 콘텐츠를 반향됩니다? – fotanus

    +0

    테이블은 PHP 섹션에 있습니다. – user2752481

    답변

    1

    CSS 속성을 더 명확하게 볼 수 있도록 CSS와 PHP 스크립트를 구분하는 것이 좋습니다. 매번 echo를 추가하는 대신 변수를 추가하십시오. 아마도 귀하의 스타일에 대해 "text-align"대신 "맞춤"이라고 적었습니다. CSS 파일에서

    다음
    $string = "<table style='width:100%;'><tr><td>"; 
    $string .= "<div class="my-style"><table>"; 
    $string .= "..."; 
    

    :

    .my-style { 
    min-height:500px; 
    margin-top: 10px; 
    } 
    
    .my-style table { 
    -moz-border-radius:15px; 
    border-radius: 15px; 
    border-bottom:1px solid gray; 
    text-align: left; 
    float: left; 
    background- color:white; 
    margin: auto;width: 75%; 
    } 
    

    UPDATE

    당신이 옆에 두 개의 테이블 측하려면 다음

    .table1 { 
        width:auto; 
        max-width:49%; 
        display:block; 
        float:left; 
    } 
    .table2 { 
        width:auto; 
        max-width:49%; 
        display:block; 
        float:right; 
    } 
    
    관련 문제