gpt4 book ai didi

twitter-bootstrap - Bootstrap 5 - 3 列布局和文本右对齐

转载 作者:行者123 更新时间:2023-12-04 16:34:52 26 4
gpt4 key购买 nike

我正在创建个人资料页面。

<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Hugo 0.80.0">
<title>Detailed View</title>

<link rel="canonical" href="">

<link href="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0c2cfcfd4d3d4d2c1d0e0958e908e908dc2c5d4c192" rel="noreferrer noopener nofollow">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c4a6ababb0b7b0b6a5b4e9ada7abaab784f5eaf0eaf4" rel="noreferrer noopener nofollow">[email protected]</a>/font/bootstrap-icons.css">

<!-- Favicons -->
<link rel="apple-touch-icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/manifest.json">
<link rel="mask-icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/safari-pinned-tab.svg" color="#7952b3">
<link rel="icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/favicon.ico">
<meta name="theme-color" content="#7952b3">

<!-- Custom styles for this template -->
<link href="../css/t02-stockDetailView_style.css" rel="stylesheet">

</head>

<body>

<main class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>


<div class="text-center py-5 px-0">

<div class="row">

<div class="col-xs-12 col-sm-6 col-md-6 px-0">
<div class="well well-sm">
<div class="row">
<div class="col-sm-4 col-md-4">
<img src="http://placehold.it/380x500" alt="" class="img-thumbnail" />
</div>
<div class="col-sm-4 col-md-4">
<h4>
Bhaumik Patel</h4>
<p>CEO of Apple Inc.</p>
<small><cite title="San Francisco, USA">San Francisco, USA <i
class="glyphicon glyphicon-map-marker">
</i></cite></small>
<p>
<i class="bi bi-envelope"></i> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ddb8b0bcb4b19db8a5bcb0adb1b8f3beb2b0" rel="noreferrer noopener nofollow">[email protected]</a>
<br/>
<i class="bi bi-globe"></i><a href="http://www.jquery2dotnet.com"> www.jquery2dotnet.com</a>
<br/>
<i class="bi bi-gift"></i> June 02, 1988</p>
</div>
<div class="col-sm-4 col-md-4">
<br>Last Trade: 12.March 2021
<br>#Shares: 123.432
<br>Type of Transaction: <span class="badge bg-danger">Buy</span>
</div>

</div>
</div>
</div>
</div>

<div class="row mt-3">

<ul class="nav nav-pills nav-fill" id="pills-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">test</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">...</div>
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">test2</div>
</div>

</div>


</div>

</main>
<!-- /.container -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5878a8a919691978495a5d0cbd5cbd5c887809184d7" rel="noreferrer noopener nofollow">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>

</body>

</html>

我想按以下方式创建布局:

enter image description here

我尝试使用 col-sm-4 拆分所有列,但是文本仍然粘在名称配置文件框中。

有关如何向右对齐文本以及如何在右侧对齐内部文本的任何建议。

感谢您的回复!

最佳答案

我已修改您的示例以匹配您所需的屏幕截图(右对齐交易文本除外):

rendered output

这是更改的摘要:

  1. 将周围容器更改为始终为 col-12 :<div class="col-12 px-0">
  2. 将内部左侧 div 设置为 <div class="col-sm-4 col-md-3">
  3. 将内部中间 div 设置为 <div class="col-sm-5 col-md-6 text-center text-sm-start">
    • 移动文本将居中对齐; sm上面将左对齐
  4. 将右侧内部 div 设置为 <div class="col-sm-3 text-center text-sm-end">
    • 移动文本将居中对齐; sm及以上内容将右对齐(如果您希望左对齐,请更改为 text-sm-start)

<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Hugo 0.80.0">
<title>Detailed View</title>

<link rel="canonical" href="">

<link href="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90f2ffffe4e3e4e2f1e0d0a5bea0bea0bdf2f5e4f1a2" rel="noreferrer noopener nofollow">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6a0805051e191e180b1a4703090504192a5b445e445a" rel="noreferrer noopener nofollow">[email protected]</a>/font/bootstrap-icons.css">

<!-- Favicons -->
<link rel="apple-touch-icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/manifest.json">
<link rel="mask-icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/safari-pinned-tab.svg" color="#7952b3">
<link rel="icon" href="https://getbootstrap.com/docs/5.0/assets/img/favicons/favicon.ico">
<meta name="theme-color" content="#7952b3">

<!-- Custom styles for this template -->
<link href="../css/t02-stockDetailView_style.css" rel="stylesheet">
</head>

<body>
<main class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Library</li>
</ol>
</nav>

<div class="text-center py-5 px-0">
<div class="row">
<div class="co-12 px-0">
<div class="well well-sm">
<div class="row">
<div class="col-sm-4 col-md-3">
<img src="http://placehold.it/380x500" alt="" class="img-thumbnail" />
</div>
<div class="col-sm-5 col-md-6 text-center text-sm-start">
<h4>Bhaumik Patel</h4>
<p>CEO of Apple Inc.</p>
<small>
<cite title="San Francisco, USA">San Francisco, USA <i class="glyphicon glyphicon-map-marker"></i></cite>
</small>
<p>
<span class="d-block"><i class="bi bi-envelope"></i> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="781d15191114381d00191508141d561b1715" rel="noreferrer noopener nofollow">[email protected]</a></span>
<span class="d-block"><i class="bi bi-globe"></i> <a href="http://www.jquery2dotnet.com">www.jquery2dotnet.com</a></span>
<span class="d-block"><i class="bi bi-gift"></i> June 02, 1988</span>
</p>
</div>
<div class="col-sm-3 text-center text-sm-end">
<span class="d-block">Last Trade: 12.March 2021</span>
<span class="d-block">#Shares: 123.432</span>
<span class="d-block">Type of Transaction: <span class="badge bg-danger">Buy</span></span>
</div>
</div>
</div>
</div>
</div>

<div class="row mt-3">
<ul class="nav nav-pills nav-fill px-0" id="pills-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</a>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab">test</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">...</div>
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">test2</div>
</div>
</div>
</div>
</main>
<!-- /.container -->

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="03616c6c77707771627343362d332d332e6166776231" rel="noreferrer noopener nofollow">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
</body>

</html>

关于twitter-bootstrap - Bootstrap 5 - 3 列布局和文本右对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66740806/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com