2016-09-29 3 views
0

私はブートストラップで作業しています。これが私の最初の試みです。ページの左側にメニューを表示しようとしていますが、一度展開すると、メニューがテーブルの上に表示されます。だから.....私はまた、私がCSSで持っている 'トランジションアニメーション'にする必要があります。私は約二日間、ここで壁に頭を叩いていますが、それを得ることはできません。私が何をしたかについてのアドバイスは?ブートストラップのメニューレイアウト

:私は私が欲しいものではなく、何を得る

@charset "utf-8"; 
 

 
/* CSS Document */ 
 

 
body { 
 
    background-color: black; 
 
    color: #E8E3E3; 
 
} 
 
.bgimage { 
 
    background-position: center center; 
 
    background-size: cover; 
 
    height: 100px; 
 
    color: #3279B6; 
 
} 
 
.table-striped>tbody>tr:nth-child(odd)>td, 
 
.table-striped>tbody>tr:nth-child(odd)>th { 
 
    background-color: #3279B6; 
 
} 
 
@media all and (max-width: 500px) { 
 
    .item-list { 
 
    float: left; 
 
    width: auto; 
 
    padding: 10px; 
 
    background-color: #686868; 
 
    } 
 
} 
 
@media all and (min-width: 500px) { 
 
    .item-list div { 
 
    transition: all 1.5s; 
 
    float: left; 
 
    width: 20%; 
 
    padding: 10px; 
 
    background-color: #686868; 
 
    } 
 
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <title>Lewis Lab 1</title> 
 

 
    <!-- Bootstrap --> 
 
    <link href="css/bootstrap.css" rel="stylesheet"> 
 

 
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
 
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
 
    <!--[if lt IE 9]> 
 
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> 
 
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
 
     <![endif]--> 
 
</head> 
 

 
<body> 
 
    <header class="bgimage"> 
 
    <div class="container"> 
 
     <h1>My Todo App...</h1> 
 
    </div> 
 
    </header> 
 
    <div class="row"> 
 
    <div class="container"> 
 
     <div class="col-sm-12"> 
 
     <div class="item-list"> 
 
      <div class="item"> 
 
      <img src="http://i.stack.imgur.com/KVkTq.jpg" style="width: 20px"> 
 
      </div> 
 
      <div class="item">Todos</div> 
 
      <div class="item">Add</div> 
 
      <div class="item">Edit</div> 
 
      <div class="item">More</div> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
    <div class="container"> 
 
    <div class="col-md-10 col-xs-offset-2 col-sm-offset-0"> 
 
     <table class="table table-striped"> 
 
     <div> 
 
      <thead> 
 
      <tr> 
 
       <th>Id</th> 
 
       <th>Name</th> 
 
       <th>Description</th> 
 
       <th>Create TIme</th> 
 
       <th>User Email</th> 
 
      </tr> 
 
      </thead> 
 
      <tbody> 
 
      <tr> 
 
       <td>1</td> 
 
       <td>Dog</td> 
 
       <td>Walk the dog</td> 
 
       <td>2 pm</td> 
 
       <td>[email protected]</td> 
 
      </tr> 
 
      <tr> 
 
       <td>2</td> 
 
       <td>Cat</td> 
 
       <td>Feed the cat</td> 
 
       <td>3:13 pm</td> 
 
       <td>[email protected]</td> 
 
      </tr> 
 
      <tr> 
 
       <td>3</td> 
 
       <td>School</td> 
 
       <td>Do Lab 1</td> 
 
       <td>6 pm</td> 
 
       <td>[email protected]</td> 
 
      </tr> 
 
      <tr> 
 
       <td>4</td> 
 
       <td>Work out</td> 
 
       <td>Go to gym</td> 
 
       <td>7:15 pm</td> 
 
       <td>[email protected]</td> 
 
      </tr> 
 
      </tbody> 
 
     </table> 
 
     </div> 
 
    </div> 
 

 
    <div class="container"> 
 
     <div class="col-lg-12"> 
 
     <div class="row"> 
 

 
      <h1>Action Items</h1> 
 
      <form> 
 
      <label for="addTodo">Add Todo</label> 
 
      <input class="form-control" type="text" id="addTodo" placeholder="Add Todo"> 
 
      <label for="details">Details</label> 
 
      <input class="form-control" type="text" id="details" placeholder="Add details"> 
 
      <br> 
 
      <input class="btn btn-primary" type="submit" value="submit"> 
 
      </form> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
 
    <script src="js/jquery-1.11.3.min.js"></script> 
 

 
    <!-- Include all compiled plugins (below), or include individual files as needed --> 
 
    <script src="js/bootstrap.js"></script> 
 
</body> 
 

 
</html>

......それは、レイアウトにテーブルの上にある - メニューは左に起こっています

...

答えて

0

タグの下に開かれた<div>タグが1つありますが、これは閉じられていません。まず、削除してください。

次に、解像度が500ピクセル未満の場合に問題が発生しています。以下のCSSブロックを追加してください:

.item-list .item { 
    float:left; 
    width: auto; 
    padding: 10px; 
    background-color: #686868; 
} 

@media all and (max-width: 500px){...}メディアクエリに以下のCSSブロックを追加してください。

ここから追加バージョンを確認できます。https://jsfiddle.net/pz19r40k/1/

関連する問題