Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
124 views
in Technique[技术] by (71.8m points)

html - How to make the required grid with bootstrap

I would like to do the following markup for my page: enter image description here

Nav is already done, but I can't get the grids. Yes on the left is an array of photos, I get them from the outside. And on the top right, I want to have a total cost and a buy button. I only need to adjust the grid, the rest is done. Here is my html code now.

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml" xmlns:sec="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    ...
</head>
<body>
<div class="container">
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
       ....
    </nav>
    <div class="container">
        <div class="col-8" th:each="product : ${session.bucket}">
            <div class="card mt-2" style="width: 17rem; height: 35rem">
                <div class="view overlay">
                    <img class="card-img-top" th:src="*{product.productDto.url}">
                </div>

                <div class="card-body text-center">
                    <p class="card-text"><span th:text="${product.productDto.brandName}"></span></p>
                    <p class="card-text"><span th:text="*{product.productDto.model}"></span></p>
                    <p class="card-text"><span th:text="*{product.productDto.price}"></span>$</p>
                </div>
            </div>
        </div>
        <div class="col-4 text-center">
            <h3>Total cost</h3>
            <span>100</span>
        </div>
    </div>
</div>
</body>
</html>

With this code, I get that first there are photos, and below them is my entry and a button (it is not in the code)
Yes, I am using simple bootstrap. No other styles, I have not used

im use this code

<div class="container">
        <div class="row">
            <div class="col-md-6">
                <div class="row" th:each="product : ${session.bucket}">
                    <div class="col-md-12">
                        <div class="card mt-2" style="width: 17rem; height: 35rem">
                            <div class="view overlay">
                                <img class="card-img-top" th:src="*{product.productDto.url}">
                            </div>

                            <div class="card-body text-center">
                                <p class="card-text"><span th:text="${product.productDto.brandName}"></span></p>
                                <p class="card-text"><span th:text="*{product.productDto.model}"></span></p>
                                <p class="card-text"><span th:text="*{product.productDto.price}"></span>$</p>
                            </div>
                        </div>
                    </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6 text-center">
                <div class="text-center">
                    <h3>Total cost</h3>
                    <span>100</span>
                </div>
            </div>
        </div>
    </div>

enter image description here

question from:https://stackoverflow.com/questions/65847938/how-to-make-the-required-grid-with-bootstrap

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You could do something simple like this:

HTML

<div class="container">
   <div class="row">
      <div class="col-md-6">
         <div class="row">
            <div class="col-md-12">Photo</div>
            <div class="col-md-12">Photo</div>
            <div class="col-md-12">Photo</div>
         </div>
      </div>
      <div class="col-md-6 text-center">
         <h3>Total cost</h3>
         <span>100</span>
      </div>          
   </div>
</div>

You can nest rows and columns to get your design. The markup above is one way to do it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...