2016-11-26 17 views
1

早上好,歡樂的週六給大家,在我的設計中,我忘記了正確的列。可以添加一個正確的列嗎?

我的網頁沒有錯,但我剛剛意識到我犯了一個錯誤,只創建了一個主要內容列。我確實需要列出主要內容。左欄專用於主要內容,右欄專用於其他小東西,如橫幅和其他div。

右欄寬度必須容納寬度爲336px的廣告橫幅。只是爲了讓你瞭解右列的寬度必須是多少。

我該如何做到這一點?

非常感謝您的幫助。

下面是我當前的CSS代碼:

<style> 

    .navmenu { 
     background-color: #FFFFFF; 
    } 

    .navmenu ul { 
     margin: 0; 
     padding: 0; 
     list-style-type: none; 
     display: flex; 
     align-items: center; 
    } 

    .navmenu li:last-child { 
     margin-left: auto; 
    } 

    .navmenu ul li a { 
     text-decoration: none; 
     margin: 4px; 
     padding: 5px 20px 5px 20px; 
     color: #FFFFFF; 
     background: #4285F4; 
     display: inline-block; 
    } 

    .main-content { 
     padding: 5px 20px 5px 20px; 
     line-height: 18px; 
    } 

</style> 

由於這是我的整個頁面:

<!doctype html> 
 

 
<html lang="en"> 
 
<head> 
 
    <meta charset="utf-8"> 
 

 
     <title>CLIHELP - Help for Command Line Interface</title> 
 
     <meta name="description" content="Help for Command Line Interface"> 
 
     <meta name="author" content="clihelp.org"> 
 

 
    <style> 
 

 
     .navmenu { 
 
      background-color: #FFFFFF; 
 
     } 
 

 
     .navmenu ul { 
 
      margin: 0; 
 
      padding: 0; 
 
      list-style-type: none; 
 
      display: flex; 
 
      align-items: center; 
 
     } 
 

 
     .navmenu li:last-child { 
 
      margin-left: auto; 
 
     } 
 

 
     .navmenu ul li a { 
 
      text-decoration: none; 
 
      margin: 4px; 
 
      padding: 5px 20px 5px 20px; 
 
      color: #FFFFFF; 
 
      background: #4285F4; 
 
      display: inline-block; 
 
     } 
 

 
     .main-content { 
 
      padding: 5px 20px 5px 20px; 
 
      line-height: 18px; 
 
     } 
 

 
     .feedback-search { 
 
      font-size: 13px; 
 
     } 
 

 
     .feedback-search a { 
 
      text-decoration: none; 
 
     } 
 

 
     .feedback-search a:hover { 
 
      text-decoration: underline; 
 
     } 
 

 
     .title { 
 
      font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; 
 
      font-size: 18px; 
 
     } 
 

 
     .title a { 
 
      text-decoration: none; 
 
     } 
 

 
     .title a:hover { 
 
      text-decoration: underline; 
 
     } 
 

 
     .tags { 
 
      font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; 
 
      font-size: 13px; 
 
      color: #006621; 
 
     } 
 

 
     .script { 
 
      font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; 
 
      font-size: 13px; 
 
     } 
 

 
    </style> 
 

 
</head> 
 
<body> 
 
    <div class="navmenu"> 
 
     <ul id=menu> 
 
      <li><a href="http://www.clihelp.org/Clihelp%20V2/index.php">Clihelp</a></li> 
 
      <li><form action='q.php' method='GET'> 
 
       <input type='text' size='25' name='search'> 
 
       <input type='submit' style='position: absolute; left: -9999px' name='submit'/> 
 
        </form></li> 
 
     </ul> 
 
    </div> 
 

 
    <div class="main-content"> 
 
    <?php 
 

 
     $button = $_GET ['submit']; 
 
     $search = $_GET ['search']; 
 

 
     if (!$button) 
 
      echo "you didn't submit a keyword"; 
 
     else { 
 
      if (strlen($search) <= 1) 
 
      echo "Search term too short"; 
 
      else { 
 
      echo "<p>Your search - <b>$search</b> "; 
 

 
      mysql_connect("localhost", "username", "password"); 
 
      mysql_select_db("db"); 
 

 
      $search_exploded = explode(" ", $search); 
 

 
      foreach ($search_exploded as $search_each) { 
 

 
       $x++; 
 

 
       if ($x == 1) 
 

 
       $construct .= "(CONCAT(code,cliCommandId) LIKE '%$search_each%' OR os LIKE '%$search_each%' OR title LIKE '%$search_each%' OR tags LIKE '%$search_each%' OR script LIKE '%$search_each%') "; 
 
       else 
 
       $construct .= "AND (CONCAT(code,cliCommandId) LIKE '%$search_each%' OR os LIKE '%$search_each%' OR title LIKE '%$search_each%' OR tags LIKE '%$search_each%' OR script LIKE '%$search_each%')"; 
 

 
      } 
 

 
      $construct = "SELECT * FROM cliCommand WHERE $construct"; 
 
      $run = mysql_query($construct); 
 

 
      $foundnum = mysql_num_rows($run); 
 

 
      if ($foundnum == 0) 
 
       echo "- did not match any documents.</br></br>Suggestions:</br></br>- Make sure all words are spelled correctly.</br>- Try different keywords.</br>- Try more general keywords.</br>- Search by id."; 
 
      else { 
 
       echo "- About $foundnum results - <span class='feedback-search'><a href=''>Give us Feedback about this result</a></span><br><br>"; 
 

 
       while ($runrows = mysql_fetch_assoc($run)) { 
 
       $cliCommandId = $runrows ['cliCommandId']; 
 
       $code = $runrows ['code']; 
 
       $os = $runrows ['os']; 
 
       $title = $runrows ['title']; 
 
       $tags = $runrows ['tags']; 
 
       $script = $runrows ['script']; 
 

 
       echo " 
 
     <div class='title'><a href=''>$title</a></div> 
 
     <div class='tags'>$tags</div> 
 
     <div class='script'>$script</div><br> 
 
     <p> 
 
     "; 
 
          } 
 
        } 
 
       } 
 
     } 
 
    ?> 
 
    </div> 
 
</body> 
 
</html>

+2

添加一些html代碼 –

+0

謝謝夢想獵人,我只是添加了我的頁面的整個代碼。有任何想法嗎?謝謝 –

+0

你是不是自己設計這個網頁?! – EhsanT

回答

1

更改您的結構,增加包裝是這樣的:

<div class="wrapper"> 
    <div class="main-content"> 
    </div> 
    <div class="sidebar"> 
    </div> 
</div> 

然後在您的CSS上,您可以在包裝上使用flexbox,在主要內容上使用float: left;,在側邊欄上使用float: right;