引导程序4 - 在屏幕上显示屏幕高度为80%的3行图像 [英] Bootstrap 4 - On screen 3 images in row with 80% height of screen

查看:185
本文介绍了引导程序4 - 在屏幕上显示屏幕高度为80%的3行图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个有关网站的问题,我在Bootstrap 4的帮助下制作的。我想在页面上部的中间使用屏幕空间(没有滚动,除了移动版本)以及徽标的简单页面,全宽navbar,然后2行3全宽图像,这将裁剪允许时裁剪。

那据说,你的html代码应该是这样的:

 < div class =container> 
< div class =row Logo>
< div class =col-sm-3>
<! - 这是您应该放置您的徽标图片的地方 - >
< / div>
< / div>
< div class =row Menu>
< div class =col-sm-12>
<! - 这是您的菜单进入的地方 - >
< / div>
< / div>
< div class =row Images>
< div class =col-sm-4>
<! - 您的第一张图片 - >
< / div>
< div class =col-sm-4>
<! - 您的第二张图片 - >
< / div>
< div class =col-sm-4>
<! - 您的第三张图片 - >
< / div>
< div class =col-sm-4>
<! - 您的第四张图片 - >
< / div>
< div class =col-sm-4>
<! - 您的第五张图片 - >
< / div>
< div class =col-sm-4>
<! - 您的最后一张图片 - >
< / div>
< / div>
< / div>

另外,请查看引导布局页面 https://getbootstrap.com/docs/4.0/layout/grid/


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;
}

解决方案

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/

这篇关于引导程序4 - 在屏幕上显示屏幕高度为80%的3行图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆