gpt4 book ai didi

css - Chrome 破坏了布局,我该如何解决?

转载 作者:行者123 更新时间:2023-11-28 16:56:11 25 4
gpt4 key购买 nike

我在 Google Chrome 中呈现某些元素时遇到问题。当我使用 Firefox 或 Edge 测试代码时,一切正常。 Chrome 似乎为“col-sm-1”计算了较小的宽度,或者忽略了填充。

我有以下 html:

/*dropdown size*/

.dropdown-sm {
font-size: 1.25rem;
}


/* Custom dropdown */

.custom-dropdown {
position: relative;
display: inline-block;
vertical-align: middle;
margin-right: 10px;
/* margin: 10px; */
}

.custom-dropdown select {
background-color: #00c292;
color: #fff;
font-size: inherit;
padding: .5em;
padding-right: 2.5em;
border: 0;
margin: 0;
border-radius: 3px;
text-indent: 0.01px;
text-overflow: '';
-webkit-appearance: button;
}

.custom-dropdown::before,
.custom-dropdown::after {
content: "";
position: absolute;
pointer-events: none;
}

.custom-dropdown::after {
content: "\25BC";
height: 1em;
font-size: .625em;
line-height: 1;
right: 1.2em;
top: 50%;
margin-top: -.5em;
}

.custom-dropdown::before {
width: 2em;
right: 0;
top: 0;
bottom: 0;
border-radius: 0 3px 3px 0;
}

.custom-dropdown select[disabled] {
color: rgba(0, 0, 0, .3);
}

.custom-dropdown select[disabled]::after {
color: rgba(0, 0, 0, .1);
}

.custom-dropdown::before {
background-color: rgba(0, 0, 0, .15);
}

.custom-dropdown::after {
color: rgba(0, 0, 0, .4);
}
<!doctype html>
<html>

<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="checkbox.css">
</head>

<body>
<main role="main">
<div id="boottom-page" class="container-fluid">
<div class="row">
<div class="col-sm-1">
<span class="custom-dropdown dropdown-sm">
<select data-name="change-role">
<option>Change role to...</option>
<option>User</option>
<option>Author</option>
<option>Admin</option>
</select>
</span>
</div>
<div class="col-sm-2">
<div>
<div>
<button type="button" class="btn btn-info">Change </button>
<button type="button" class="btn btn-info">Delete</button>
</div>
</div>
</div>
</div>
</div>
</main>
</body>

</html>

Firefox 和 Edge 都能很好地渲染它们:

但是 Chrome 破坏了布局:

如何解决 Chrome 的布局问题?

最佳答案

在 Firefox 和 Chrome 中测试了您的代码。它们看起来几乎一样,没有任何东西破坏布局。

但在您的屏幕截图中,它们的尺寸不同。

I think there are different zoomlevels set in your browsers. Please check if both are on 100%;

关于css - Chrome 破坏了布局,我该如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56668625/

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