【发布时间】:2022-01-02 09:19:21
【问题描述】:
我试图对齐我的搜索栏,使其居中,但由于某种原因它停留在左侧,这是我的代码:
<head>
<style>
html {
overflow: auto;
}
html,
body,
iframe {
margin: 0px;
padding: 0px;
height: 100%;
border: none;
}
iframe {
display: block;
width: 100%;
border: none;
overflow-y: auto;
overflow-x: hidden;
}
@media (min-width: 1200px) {
.container{
max-width: 400px;
}
}
#over { font-size:5em; position:absolute; top:20px; left:20px; z-index:2 }
</style>
</head>
<div id="over" class="container">
<div class="row">
<div id="over" class="input-group bg-white">
<input type="search" id="mapinput" class="form-control rounded" placeholder="Город" aria-label="Search"
aria-describedby="search-addon" />
<button type="button" onclick="changecity();" class="btn btn-outline-primary">Поиск</button>
</div>
</div>
</div>
<iframe id="mapframe" src="https://maps.google.com/maps?q=Moscow&t=k&z=13&ie=UTF8&iwloc=&output=embed" style="border: 0; width: 100%; height: 100%">Your browser doesn't support iFrames.</iframe>
这就是displays
如何解决此问题并将搜索栏置于中心位置?
【问题讨论】:
-
你尝试过 text-center 类吗?不确定它是否需要在元素或父元素上!
-
是的,我做到了,但没用。
标签: html css bootstrap-4