0
0

Здравствуйте. На уроке 2.2 Библиотека Bootstrap 4 делала все как Иван, но у меня почему-то на странице не было отступа слева и при подключении режима совместимости картинки не перестраивались, а наезжали друг на друга.https://yadi.sk/i/WQWArrVFjUsWvg https://yadi.sk/i/qxGXPtNuDwMDug

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

    <title>Bootstrap</title>
  </head>
  <body>
    
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <a class="navbar-brand" href="#">Main page</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
      
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
          <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
              <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#">Link</a>
            </li>
            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Dropdown
              </a>
              <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                <a class="dropdown-item" href="#">Action</a>
                <a class="dropdown-item" href="#">Another action</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="#">Something else here</a>
              </div>
            </li>
            <li class="nav-item">
              <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
            </li>
          </ul>
          <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-light my-2 my-sm-0" type="submit">Search</button>
          </form>
        </div>
      </nav>

    <div class="conteiner">
        <div class="row">
            <div class="col">
                <div class="card mt-5" style="width: 18rem;">
                    <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                        <a href="#" class="btn btn-primary">Go somewhere</a>
                     </div>
                </div>
            </div>
            <div class="col">
                <div class="card mt-5" style="width: 18rem;">
                    <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                        <a href="#" class="btn btn-primary">Go somewhere</a>
                    </div>
                </div>
            </div>
            <div class="col">
                <div class="card mt-5" style="width: 18rem;">
                    <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                        <a href="#" class="btn btn-primary">Go somewhere</a>
                    </div>
                </div>
            </div>
          </div>
         
          <div class="row">
            <div class="col">
                <div class="card mt-5" style="width: 18rem;">
                    <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                        <a href="#" class="btn btn-primary">Go somewhere</a>
                     </div>
                </div>
            </div>
            <div class="col">
                <div class="card mt-5" style="width: 18rem;">
                    <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                        <a href="#" class="btn btn-primary">Go somewhere</a>
                    </div>
                </div>
            </div>
            <div class="col">
                <div class="card mt-5" style="width: 18rem;">
                    <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="card-img-top" alt="...">
                    <div class="card-body">
                        <h5 class="card-title">Card title</h5>
                        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                        <a href="#" class="btn btn-primary">Go somewhere</a>
                    </div>
                </div>
            </div>
          </div>

          <div id="carouselExampleControls" class="carousel slide mt-5 mb-5"  data-ride="carousel">
            <div class="carousel-inner">
              <div class="carousel-item active">
                <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="d-block w-100" alt="...">
              </div>
              <div class="carousel-item">
                <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="d-block w-100" alt="...">
              </div>
              <div class="carousel-item">
                <img src="https://cdn.pixabay.com/photo/2020/06/11/13/56/lighthouse-5286823_1280.jpg" class="d-block w-100" alt="...">
              </div>
            </div>
            <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
              <span class="carousel-control-prev-icon" aria-hidden="true"></span>
              <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
              <span class="carousel-control-next-icon" aria-hidden="true"></span>
              <span class="sr-only">Next</span>
            </a>
          </div>

      </div>

    <!-- Optional JavaScript --> 
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
  </body>
</html>


Наталья Макарова
4 years ago






Спасибо большое. Получилось, а игра - супер!!!

Наталья Макарова
4 years ago

проверьте пожалуйста написание классов допустим класс container, а у Вас написан класс conteiner так как Bootstrap имеет ряд зарезервированных названий классов верстка может отличаться от результата Ивана.

я так же рекомендую вам поиграть в увлекательную игру https://flexboxfroggy.com/#ru для понимания того как управлять элементами на странице с помощью флекс, так как Bootstrap это библиотека построенная на этом.

и еще вот тут тоже очень понятно все про флекс https://css-tricks.com/snippets/css/a-guide-to-flexbox/

Alex B
4 years ago

2 ответов