2016-09-29 3 views
0

Я работаю с Bootstrap, и это моя первая попытка. Я пытаюсь иметь меню в левой части страницы, но как только мы расширяем - я хочу, чтобы меню было сверху таблицы. Так что ..... я также должен перейти к «анимации перехода», который у меня есть в css. Я бил головой о стену здесь около двух дней, но, похоже, не понял. Какие-нибудь советы о том, что я сделал? Меню будет слева - но он находится на верхней части таблицы в макете ......Расположение меню в Bootstrap

@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>, которая не была закрыта под тегом <table class="table table-striped">. Во-первых, удалите его.

Далее, ваша проблема возникает, когда разрешение меньше 500 пикселей. Пожалуйста, добавьте блок CSS ниже:

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

в запрос @media all and (max-width: 500px){...} СМИ.

Вы можете проверить добавленную версию отсюда: https://jsfiddle.net/pz19r40k/1/

Смежные вопросы