Bootstrap 4 - On screen 3 images in row with 80% h

2019-07-26 14:59发布

I have couple of questions about site, which I'm making with help of Bootstrap 4. I would like to make simple page just using on screen space (no scroll except mobile version) with logo in the upper middle of the page, full width navbar and then 2 rows of 3 full width images, which would be cropped as resolution allows. Here is the sketch. I made some HTML/CSS proposals, but they didn't work properly. Do you have some ideas how to make it? :/

Thanks a lot!

  <!DOCTYPE html>
  <html lang ="cs">
  <head>
  <meta charset="utf-8">
  <!-- Mobile adaptation -->
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- Page information -->
  <meta name="description" content="GeoExpo Eshop. Od replik přes zkameněliny do trilobitů.">
  <meta name="keywords" content="eshop zoo, eshop Zoo Praha, GeoExpo, zkameněliny, suvenýry, repliky, šutry, kameny">
  <meta name="author" content="Ondřej Sloup">

  <!-- Mine Stylesheet -->
  <link rel="stylesheet" href="stylesheet/stylesheet.css">
  <!-- Imported Stylesheets -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
    <script defer src="https://use.fontawesome.com/releases/v5.0.4/js/all.js"></script>


  <!-- Scripts (jQuery) -->
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.min.js" integrity="sha384-a5N7Y/aK3qNeh15eJKGWxsqtnX/wWdSZSKp+81YjTmS15nvnvxKHuzaWwXHDli+4" crossorigin="anonymous"></script>

  <!-- Tittle -->
  <title>Geo Expo</title>
 </head>
 <body>

  <header> 
    <img class="logo d-block img-fluid mx-auto" src="./logo/PNG.png" alt="Logo" />                     
  </header>

  <nav class="navbar navbar-expand-lg">
     <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Toogle" aria-controls="Toogle" aria-expanded="false" aria-label="Toggle navigation">
     <span class="navbar-toggler-icon"><i class="fa fa-bars mx-auto" aria-hidden="true"></i></span>
     </button>
     <div class="collapse navbar-collapse" id="Toogle">
        <ul class="navbar-nav mt-2 mt-lg-0 mx-auto">
            <li class="nav-item">
                <a class="nav-link" href="#">Home</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Repliky</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Unikáty</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Instalace</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Kontakt</a>
           </li>
        </ul>
     </div>
  </nav>

<main class="container-fluid p-0">
     <div class="row align-items-center no-gutters">
        <div class="col-4">
                <img class="image" width="auto" src="./images/bridge.jpg" alt="Bridge">
        </div>
        <div class="col-4">
                <img class="image" width="auto" src="./images/park.jpg" alt="Park">
        </div>
        <div class="col-4">
                <img class="image" width="auto" src="./images/tunnel.jpg" alt="Tunnel">
        </div>
    </div>
        <div class="row align-items-center no-gutters">
        <div class="col-4">
                <img class="image" width="auto" src="./images/bridge.jpg" alt="Bridge">
        </div>
        <div class="col-4">
                <img class="image" width="auto" src="./images/park.jpg" alt="Park">
        </div>
        <div class="col-4">
                <img class="image" width="auto" src="./images/tunnel.jpg" alt="Tunnel">
        </div>
    </div>
  </main>

And CSS

    /*INSERT*/
 @import url('https://fonts.googleapis.com/css?family=Cinzel+Decorative');
 @import url('https://fonts.googleapis.com/css?family=Cinzel');
/*ALL*/
 html, body, main {
    height: 100% !important;
     max-width: 100% !important;
}
 body {
    background: grey !important;
}
/*Header*/
 header {
    height: 15%;
}
 .logo {
    display: inline-block;
     padding: 1rem 0 .5rem 0 !important;
}
/*Images*/
 .row {
    height: 30% !important;
}
/* NavBar */
 nav {
    font-size: 13pt;
     font-family: 'Cinzel', sans-serif;
     padding: .3rem 0 .3rem 0 !important;
     text-transform: capitalize;
}
 .nav-link {
    color: #fff !important;
     margin: 0 25% 0 25%;
}
 .nav-link:hover {
    font-style: underline;
}

1条回答
SAY GOODBYE
2楼-- · 2019-07-26 15:43

For future, you can use the http://shoelace.io/

That being said, your html code should look like this:

<div class="container">
    <div class="row Logo">
        <div class="col-sm-3">
                <!-- This is where you should put your logo image -->
        </div>
    </div>
    <div class="row Menu">
        <div class="col-sm-12">
        <!-- this is where your menu goes in -->
        </div>
    </div>
    <div class="row Images">
        <div class="col-sm-4">
            <!-- your first image -->
        </div>
        <div class="col-sm-4">
            <!-- your second image -->
        </div>
        <div class="col-sm-4">
            <!-- your third image -->
        </div>
        <div class="col-sm-4">
            <!-- your forth image -->
        </div>
        <div class="col-sm-4">
            <!-- your fifth image -->
        </div>
        <div class="col-sm-4">
            <!-- your last image -->
        </div>
    </div>
</div>

Also, have a look at the bootstrap layout page https://getbootstrap.com/docs/4.0/layout/grid/

查看更多
登录 后发表回答