gpt4 book ai didi

html - 使用 Bootstrap 在 html 中居中 Logo

转载 作者:行者123 更新时间:2023-11-28 06:05:51 26 4
gpt4 key购买 nike

我有一张 1007 像素 x 81 像素的图像,我将其用作网站的 Logo ,如果不使用 margin-left,我无法将其居中。我试过 margin: 0, auto;

.navbar-brand {
width:100%;
height:auto;
margin-left: 35%
}

最佳答案

我假设你的意思是水平居中,因为你的元素有宽度,你可以简单地设置它的 margin-left:auto;和 margin-right:auto;

但是设置宽度:100%;实际上会占据其父项的全部大小,这意味着您需要将父项而不是子项居中。

关于html - 使用 Bootstrap 在 html 中居中 Logo ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36462349/

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