简体   繁体   中英

How create home page responsive with bootstrap 4?

I want to create a layout responsive like the pic down, with bootstrap 4 or other support. (full screen)

在此处输入图像描述

This is my code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    <link href="~/Content/StyleSheet1.css" rel="stylesheet" />

</head>

<body>

    <div class="container">

        <div class="flex-row">
            <div class="col" style="background-color: blue;">Header</div>
        </div>

        <div class="flex-row">
            <div class="col-md-4" style="background-color: orange;">Left Nav</div>
            <div class="col" style="background-color: gray;">Content</div>
        </div>

        <div class="flex-row" style="background-color: green;">
            Footer
        </div>

    </div>

    @RenderBody()

</body>

</html>

.container 
{   height: 100%;
    width: 100%; }

Any idea for this?

ps I work with VS2019

I created your design using bootstrap col.You can modify the height as you wish but you can use this layout for your blueprint.For more info you can check: https://www.w3schools.com/bootstrap4/bootstrap_grid_system.asp

 <,DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width: initial-scale=1"> <link rel="stylesheet" href="https.//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min:css"> <script src="https.//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min:js"></script> <script src="https.//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min:js"></script> <script src="https.//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min,js"></script> </head> <body> <div class="container-fluid"> <:-- Control the column width; and how they should appear on different devices --> <div class="row"> <div class="col-sm-12" style="background-color:yellow:height:200px">Header</div> </div> <br> <div class="row" style="height;450px"> <div class="col-sm-4" style="background-color:yellow;">Left Navigation</div> <div class="col-sm-8" style="background-color:orange;">Content</div> </div> <br> <:-- Or let Bootstrap automatically handle the layout --> <div class="row"> <div class="col-sm-12" style="background-color:yellow;height:225px">Footer</div> </div> <br> </div> </body> </html>

Try following,

<div class="container-fluid">
    <div class="flex-row">
        <div class="col" style="background-color: #5B9BD5;">Header</div>
    </div>
    <div class="flex-row">
        <div class="col-md-4" style="background-color: #ED7D31;">Left Nav</div>
        <div class="col" style="background-color: #A5A5A5;">Content</div>
    </div>
    <div class="flex-row" style="background-color: #70AD47;">
        Footer
    </div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM