bootstrap-4 相关问题

Bootstrap 4是流行的前端组件库的第四个主要版本。 Bootstrap框架有助于创建响应迅速,移动优先的网站和Web应用程序。

更改 ng-bootstrap 轮播中的箭头颜色

我正在使用 ng-bootstrap 创建轮播,我想将箭头颜色或图像从白色更改为黑色,因为我有白色背景图像并且它们是不可见的。我的问题是我无法获得跨度,...

回答 6 投票 0

如何设置 Bootstrap 4 toast 的宽度?

我有一个带有 Bootstrap 4 toast 的页面,我将 toast 的位置设置为位置:固定。整个吐司部分如下所示: 我有一个带有 Bootstrap 4 toast 的页面,我将 toast 的位置设置为 postion: fixed。整个吐司部分是这样的: <div class="container mt-5"> <button type="button" class="btn btn-primary" id="liveToastBtn">Toast it</button> <div id="toastContainer" style="position: fixed; top: 1.5vw; right: 1vw; bottom: 4.5vw; z-index: 9;"> <div class="toast show" role="alert" aria-live="assertive" aria-atomic="true"> <div class="toast-header"> <img src="..." class="rounded mr-2" alt="..."> <strong class="mr-auto">Bootstrap</strong> <small>11 mins ago</small> <button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="toast-body"> Hello, world! This is a toast message. </div> </div> </div> </div> 您可以在 this JSFiddle 中找到完整的工作代码。 该作品按原样工作得很好,但现在我想将 toast 的宽度设置为视口的 50% 左右。在 <div id="toastContainer"...> 行中,我尝试设置 width 属性: <div id="toastContainer" style="position: fixed; top: 1.5vw; width: 50%; right: 1vw; bottom: 4.5vw; z-index: 9;"> 或者我尝试设置left: <div id="toastContainer" style="position: fixed; top: 1.5vw; left: 50%; right: 1vw; bottom: 4.5vw; z-index: 9;"> 但在这两种情况下,出现的 toast 的 width 都不会改变(仅其水平 position)。 如何设置 Bootstrap 4 toast 的宽度? 我找到了办法。它也有帮助,它在网站上,我可以直接在上面尝试东西,让事情变得更容易。 我不知道你是否熟悉 bootstrap 但是有这样的东西可以让你通过将 class="col-x" (x 在 1-12 之间)的东西放入 a 中来“控制”东西的长度div 与 class="row"。 <div class="row"> <button type="button" class="btn btn-primary col-8" id="liveToastBtn">Toast it</button> </div> 正如你所看到的,这就是我所做的,只需在按钮的类中添加 col-8 即可,你可以更改它,但我发现 6 看起来不像 50% 8 更接近。 然后你需要一些CSS来使按钮居中: .row{ display:flex; justify-content:center; } 希望这就是您正在寻找的🥶🥶🥶🥶🥶🥶

回答 1 投票 0

表格标题与列未对齐。第 1 列上方的所有标题。ASP.NET Core 6

一个奇怪的。我正在使用 ASP.NET Core 6、jQuery 和 Bootstrap 4。应用程序中的大多数表的标题与列未对齐。所有标题似乎都在第一列上方...

回答 1 投票 0

自从迁移到 Angular 13 以来未捕获 DOMException

我在我的 Angular 项目中使用 Bootstrap 4.6.2。其中一个组件有一张带有 ngb-accordion 的表格。在我将项目迁移到 Angular 13 之前,一切都运行良好。 现在,我得到以下内容

回答 1 投票 0

一行上的多个单选按钮 - Bootstrap 4

我尝试了文档中的代码(https://v4-alpha.getbootstrap.com/components/forms/#form-controls)并找到了如何实现这一点: 代码如下: ... 我尝试了文档中的代码(https://v4-alpha.getbootstrap.com/components/forms/#form-controls)并找到了如何实现这一点: 代码如下: <div class="container"> <form> <div class="form-group row"> <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> <div class="col-sm-10"> <input type="email" class="form-control" id="inputEmail3" placeholder="Email"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label> <div class="col-sm-10"> <input type="password" class="form-control" id="inputPassword3" placeholder="Password"> </div> </div> <fieldset class="form-group row"> <legend class="col-form-legend col-sm-2">Radios</legend> <div class="col-sm-10"> <div class="form-check"> <label class="form-check-label"> <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> Option one is this and that&mdash;be sure to include why it's great </label> </div> <div class="form-check"> <label class="form-check-label"> <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2"> Option two can be something else and selecting it will deselect option one </label> </div> <div class="form-check disabled"> <label class="form-check-label"> <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled> Option three is disabled </label> </div> </div> </fieldset> <div class="form-group row"> <label class="col-sm-2">Checkbox</label> <div class="col-sm-10"> <div class="form-check"> <label class="form-check-label"> <input class="form-check-input" type="checkbox"> Check me out </label> </div> </div> </div> <div class="form-group row"> <div class="offset-sm-2 col-sm-10"> <button type="submit" class="btn btn-primary">Sign in</button> </div> </div> </form> </div> 但是,我希望能够像这样将所有内容内联: 这可能吗?怎么办? 稍后编辑:与示例中的代码类似,我需要某种带有 col-sm-2 的标签,然后将所有单选按钮放在 col-sm-10 容器中 后来编辑:我稍微编辑了 Abdeslem Charif 的代码并得到了我所需要的,非常感谢。请参阅下面的代码: <div class="form-group row"> <label class="col-sm-2">Radio: </label> <div class="col-sm-10"> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> <label class="form-check-label" for="inlineRadio1">Option one</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> <label class="form-check-label" for="inlineRadio2">Option Two</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> <label class="form-check-label" for="inlineRadio3">Option tree</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled> <label class="form-check-label" for="inlineRadio3">Option four (disabled)</label> </div> </div> </div> 使用 radio-inline 类 <div class="container"> <form> <div class="form-group row"> <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label> <div class="col-sm-10"> <input type="email" class="form-control" id="inputEmail3" placeholder="Email"> </div> </div> <div class="form-group row"> <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label> <div class="col-sm-10"> <input type="password" class="form-control" id="inputPassword3" placeholder="Password"> </div> </div> <fieldset class="form-group row"> <legend class="col-form-legend col-sm-2">Radios</legend> <div class="col-sm-10"> <div class="form-check"> <label class="form-check-label"> <input class="form-check-input radio-inline" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked> Option one</label> <label class="form-check-label"> <input class="form-check-input radio-inline" type="radio" name="gridRadios" id="gridRadios2" value="option2"> Option two</label> <label class="form-check-label disabled"> <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled> Option three</label> </div> </div> </fieldset> <div class="form-group row"> <label class="col-sm-2">Checkbox</label> <div class="col-sm-10"> <div class="form-check"> <label class="form-check-label"> <input class="form-check-input" type="checkbox"> Check me out </label> </div> </div> </div> <div class="form-group row"> <div class="offset-sm-2 col-sm-10"> <button type="submit" class="btn btn-primary">Sign in</button> </div> </div> </form> </div> 使用内联样式 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> <label class="form-check-label" for="inlineRadio1">Option one</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> <label class="form-check-label" for="inlineRadio2">Option Two</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> <label class="form-check-label" for="inlineRadio3">Option tree</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled> <label class="form-check-label" for="inlineRadio3">Option four (disabled)</label> </div> 如果您希望单选按钮出现在同一行,请使用 .radio-inline 类 <div class="radio"> <label class="radio-inline"><input type="radio" name="optradio">Option 1</label> <label class="radio-inline"><input type="radio" name="optradio">Option 2</label> <label class="radio-inline"><input type="radio" name="optradio">Option 3</label> </div> 您可以使用 div class="row" 来完成此操作,然后使用其网格系统作为列 https://getbootstrap.com/docs/4.0/layout/grid/ 问题:如何内联显示多个单选字段 修复细节:在自己的div中添加带有标签的所有其他单选字段,将它们组合在一个父级中div,然后在父级上使用css flex属性divflexbox的基本概念 .displayFlex { display: flex; } 注释: 为了控制单选字段状态,我们可以将所有单选字段的 name 属性设置为相同。 但是如果我们需要所有单选字段的状态,那么我们可以在按键更改时添加事件监听器。并通过覆盖 value 的默认 "on" 来根据要求分配单选字段值。 输入类型=“无线电”

回答 4 投票 0

如何解决 Dashploty 中的重复回调输出错误

在输出回调中: 页面内容.children 输出 0 (page-content.children) 已在使用中。 任何给定的输出只能有一个设置它的回调。 要解决这种情况,请尝试...

回答 2 投票 0

Bootstrap 4 - 折叠外的导航栏项目

好吧,我不得不承认,即使在 BS3 中,我也一直在努力正确地工作。但我希望在折叠的容器外部保持持久的导航栏链接。 ...

回答 1 投票 0

Bootstrap:使用单个选项卡导航控制多个选项卡面板

我想用一个选项卡导航来控制两个不同的选项卡内容。 在 Bootstra 3 中,我有一个用逗号分隔数据目标的解决方案(如本例所示:https://stackoverflow.com/a/19719859/

回答 3 投票 0

Laravel - 自定义 CSS 和 Bootstrap

我有一个刀片文件,其中有一个表正在从执行存储过程的控制器获取值。 当我使用时,问题出在我的刀片文件上 ...

回答 1 投票 0

如何根据引导卡中的宽度和高度调整图像?

我想在卡片中给出图像的宽度和高度(300px;300px;): 我想在卡片中给出图像的宽度和高度(300px;300px;): <!-- Card Start From Here --> <div class="card" style="width: 35rem;"> <img class="card-img-top" src="/demo/img/1.jpeg" alt="Card image cap" style="width:35rem;height:20rem;"/> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> <!-- Card Start From Here --> 产量缩水了: 如果我删除下面的代码行,那么图像会很长但不会缩小: style="width:35rem;height:20rem;" 我已经尝试过: object-fit:cover;(Check all properties like fill, scale-down) 还尝试了一些CSS: <style> .clsAutofit{ height:300px; width:300px; } .clsImg{ max-width:100%; max-height:100%; } </style> <div class="clsAutofit"> <img src="/demo/img/1.jpeg" class="clsImg" /> </div> <!-- This also not working in card --> 我还尝试了一些属性: <style> img.one { display: block; object-fit: contain; max-width:500px; max-height:280px; width: auto; height: auto; } img.two { object-fit: contain; width: 535px;; height: 535px; } .box { width: 30%; height: 200px; border: 5px dashed #f7a239; } .containerTY { width: 60%; height: 500px; } .containerTYZ { max-width: 100%; } .thumbnail { width: 500px; height: 400px; } .img4R { width: 100%; height: auto; max-width: 50vw; } </style> 我尝试过,但还没成功。 任何想法或建议都欢迎。 你的方法没问题。问题是,引导类属性往往有!important。 因此将自定义 style.css 放在 bootstrap.css 下,这样它比 bs 具有更高的优先级, 然后使用: .my-image{ height : 300px !important; width: 300px !important } 将图像与类.my-image绑定,清除内联CSS样式,然后检查这一点。 .clsImg{ max-width:100%; width: 100%; height: auto; object-fit:cover; } 使用 img-fluid 表示图像,您还可以使用 w-25 w-50 w-100 表示 lg、md、sm 等设备 @media (min-width: 768px) { .w-md-50{width:50% !important;} } @media (min-width: 992px) { .w-lg-75{width:75% !important;} } <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <div class="container"> <div class="row pt-5 w-100 mx-auto"> <!-- Card Start From Here --> <div class="col-lg-4 col-md-6 col-sm-6 mb-4"> <div class="card p-4"> <div class="row"> <div class="col-6"> <img class="card-img-top img-fluid w-lg-75 w-md-50 w-100 text-center" src="https://i.ibb.co/Xyk1kJy/1-1.jpg" alt="Card image cap"/> </div> <div class="col-12"> <div class="card-body px-0 pb-0"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> </div> </div> <!-- Card Start From Here --> <div class="col-lg-4 col-md-6 col-sm-6 mb-4"> <div class="card p-4"> <div class="row"> <div class="col-6"> <img class="card-img-top img-fluid w-lg-75 w-md-50 w-100 text-center" src="https://i.ibb.co/Xyk1kJy/1-1.jpg" alt="Card image cap"/> </div> <div class="col-12"> <div class="card-body px-0 pb-0"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> </div> </div> <!-- Card end From Here --> <!-- Card Start From Here --> <div class="col-lg-4 col-md-6 col-sm-6 mb-4"> <div class="card p-4"> <div class="row"> <div class="col-6"> <img class="card-img-top img-fluid w-lg-75 w-md-50 w-100 text-center" src="https://i.ibb.co/Xyk1kJy/1-1.jpg" alt="Card image cap"/> </div> <div class="col-12"> <div class="card-body px-0 pb-0"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> </div> </div> <!-- Card end From Here --> </div> </div>

回答 3 投票 0

为什么响应式图像在弹性容器内缩小并且不占据响应式屏幕尺寸上的整个空间?

我想防止图像在弹性盒内收缩,从而在弹性容器内留下太多空间。事实上,图像是使用 Bootstrap 5 类中的 img-fluid 类来制作响应式的......

回答 1 投票 0

Bootstrap 4 从下拉按钮中删除插入符号

在 Bootstrap 3 中,您可以轻松地从下拉按钮中删除“插入符号”(向下的小箭头),但我不知道如何在 Bootstrap 4 中执行此操作,因为它们不再使用 在 Bootstrap 3 中,您可以轻松地从下拉按钮中删除“插入符号”(向下的小箭头),但我不知道如何在 Bootstrap 4 中执行此操作,因为它们不再使用 <span class="caret"></span>。 <div class="input-group mb-3"> <div class="input-group-prepend"> <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a> <div role="separator" class="dropdown-divider"></div> <a class="dropdown-item" href="#">Separated link</a> </div> </div> <input type="text" class="form-control" aria-label="Text input with dropdown button"> </div> 只需删除dropdown-toggle! 这是一个例子: https://jsfiddle.net/ydnosrLw/ 它是用CSS完成的。做类似的事情: .dropdown-toggle:after { content: none } 您可以通过从元素中删除 dropdown-toggle 类来删除 Bootstrap 4 中的插入符号。所以代替这个: <button class="btn btn-outline-secondary dropdown-toggle" ...> 您的按钮将是 <button class="btn btn-outline-secondary" ...> 这不会有任何副作用,并且它仍然可以作为下拉菜单正常运行。 在 Bootstrap 4 中,您可以通过设置 $enable-caret sass 变量 false 来删除插入符号表单下拉按钮。但您必须在导入 bootstrap sass 文件之前设置此变量。 // Your variable overrides $enable-caret: false // Bootstrap and its default variables @import "node_modules/bootstrap/scss/bootstrap"; 我会在电话中正常使用下拉菜单,Apple rimane contornato di blu come se prende il contorno del bottone prima tu. 落下 行动 另一个动作 这里还有其他东西 questo è ili se qualcuno mi dà qualche suggerimento

回答 5 投票 0

我正在尝试使用引导程序实现以下目标

点击此处查看图片 两列: [第一列一行(包含第二列两行)] [第二列两行] 我没有引导程序方面的专业知识。你能帮我证明...

回答 1 投票 0

Bootstrap 格式中添加的 Div 弄乱了我的布局

在我将每个 H1 分成单独的部分之前,我的代码在右侧有一个图像,请在编辑之前查看页面图片 但现在 iv 分成了 div,图片位于左上角......

回答 1 投票 0

Bootstrap 4 与 Angular 17 兼容

我正在从事的项目目前使用的是 Angular 15,我们使用的是 Bootstrap 4.6.2。我们计划在 Angular 17 发布时使用它。 Angular 17 会支持 bootstrap 的版本吗...

回答 1 投票 0

当视口发生变化时,很难让一行图像响应式地调整大小

我很难让一行图像随着视口的变化而响应地调整大小。我发现当屏幕变得更窄时图像开始换行,或者有一个 awk...

回答 1 投票 0

如果太早打开,为什么我的 Bootstrap 日期选择器会被重复?

我的代码中有一个日期选择器,当我在所有请求完成之前打开日期选择器时,它会在我的日期选择器下拉列表中添加一个内联日期选择器,这是我的代码 我的代码中有一个日期选择器,当我在所有请求完成之前打开日期选择器时,它会在我的日期选择器下拉列表中添加一个内联日期选择器,这是我的代码 <div class="hand-date-picker mr-3"> @Html.TextBox("InHandDate", "", new { @class = "datepicker", @group = "inhanddate", @data_date_format = HelperMethods.GetDateFormat(), @data_test_selector = "txtInHandDate" }) <span class="icon-calendar" data-time-icon="icon-time" data-date-icon="icon-calendar"></span> </div> 并在课堂上初始化 $("#InHandDate").datepicker({ //@ts-ignore daysOfWeekDisabled: '0,6' }); $("#InHandDate").datepicker('setDaysOfWeekDisabled', [0, 6]) 并在脚本元素中 $(document).ready(function () { let minDate; if ($("input[class='PickUpShipping']").is(":checked")){ $(".CashOnPickup").show(); $("#warehouses-select").css("display", "block"); minDate = '@(HelperMethods.GetDateTime())'; } else { $(".CashOnPickup").hide(); $("#warehouses-select").css("display", "none"); minDate = '@(HelperMethods.GetDateTime().AddDays(1))'; } $("#InHandDate").datepicker('setStartDate', new Date(minDate)) }); $("input[name='ShippingOptions']").on("click", function (ev) { let minDate; if ($(this).data('shippingcode') === 'Pickup') { $(".CashOnPickup").show(); $("#warehouses-select").css("display", "block"); minDate = '@(HelperMethods.GetDateTime())'; } else { $(".CashOnPickup").hide(); $(".CashOnPickup input").prop('checked', false); $("#warehouses-select").css("display", "none"); minDate = '@(HelperMethods.GetDateTime().AddDays(1))'; } $("#InHandDate").datepicker('setStartDate', new Date(minDate)) }); $("input[name='ShippingOptions']").on("change", function (ev) { $("#InHandDate").datepicker('setDate', ""); }); 我尝试用多种方式来阻止它。但到目前为止还没有运气 显然这是因为没有设置 minDate 属性。添加'@minDate =“”' HTML 解决了问题

回答 1 投票 0

Bootstrap 4 和 Angular 展开所有动态添加的手风琴

我正在使用 Bootstrap 4 手风琴编写 Angular 代码,如下所示。 如何添加全部展开和全部折叠按钮? 我正在使用 Bootstrap 4 手风琴编写 Angular 代码,如下所示。 如何添加全部展开和全部折叠按钮? <div id="accordion"> <div *ngFor=" let Party of PartyF; let i = index;> <div class="card">6 <div class="card-header"> <button type="button" class="btn btn-link" data-toggle="collapse" [attr.data-target]="'#data' + i" aria-expanded="true" [attr.aria-controls]="'data' + i"> </button> </div> <div [attr.id]="'data' + i" class="collapse" [ngClass]="{ show: i == PartyF.length - 1}" data-parent="#accordion"> <div class="card-body"> </div> </div> </div> </div> <div id="accordion"> <button type="button" class="btn btn-primary mb-2" (click)="expandAll()">Expand All</button> <button type="button" class="btn btn-secondary mb-2" (click)="collapseAll()">Collapse All</button> <div *ngFor="let party of PartyF; let i = index;"> <div class="card"> <div class="card-header"> <button type="button" class="btn btn-link" data-toggle="collapse" [attr.data-target]="'#data' + i" (click)="togglePanel(i)" [aria-expanded]="isPanelOpen(i)" [attr.aria-controls]="'data' + i"> {{ party.title }} </button> </div> <div [attr.id]="'data' + i" class="collapse" [ngClass]="{ show: activePanels.includes(i) }" data-parent="#accordion"> <div class="card-body"> {{ party.content }} </div> </div> </div> </div> </div> 创建一个 activePanels 数组(在组件的 TypeScript 中)来跟踪当前展开的面板。 export class MyAccordionComponent { PartyF = [ // Your party data with title and content properties ]; activePanels: number[] = []; // Initially all closed togglePanel(index: number) { if (this.activePanels.includes(index)) { this.activePanels = this.activePanels.filter(p => p !== index); } else { this.activePanels.push(index); } } expandAll() { this.activePanels = [...Array(this.PartyF.length).keys()]; // Expand all } collapseAll() { this.activePanels = []; // Collapse all } isPanelOpen(index: number): boolean { return this.activePanels.includes(index); } }

回答 1 投票 0

Html + Css 在计算机上响应良好(即使在最小化模式下),但在移动设备上响应较差

我为我的asp.net项目使用了现成的模板...... 我对html和Css不太了解,只是通过反复试验删除和定制了一些代码。 为了测试移动响应,我最小化了...

回答 1 投票 0

如何为响应速度太快的标题导航栏编写 HTML CSS 代码

我想制作一个导航栏,但我无法为其编写正确的 CSS 样式。 如何制作徽标图像向左浮动、菜单内容向右浮动的导航栏。 我尝试过普通的 CS...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.