gpt4 book ai didi

javascript - CSS - 定位滚动 div

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

HTML:

<div class="wrapper">
<div class="scrolls">
<img src="http://avatar.hivemc.com/avatar/aruturek/100" />aruturek
<img src="http://avatar.hivemc.com/avatar/aruturek/100" />aruturek
<img src="http://avatar.hivemc.com/avatar/aruturek/100" />aruturek
<img src="http://avatar.hivemc.com/avatar/aruturek/100" />aruturek
</div>
</div>

CSS:

.wrapper { 
background:#EFEFEF;
margin: auto;
;
text-align: center;
position: relative;
margin-bottom: 20px !important;
width: 540px;
padding-top: 5px;
}
.scrolls {
overflow-x: scroll;
overflow-y: hidden;
height: 150px;
white-space:nowrap
}
.imageDiv img {
margin: 2px;
max-height: 100px;
cursor: pointer;
display: inline;
*display:inline;
*zoom:1;
vertical-align:top;
}

这是结果: qshg7muq9vam.png http://jsfiddle.net/masgp4fg/但我想文本“aruturek”位于图像下方,并且居中。

______________
| |
| |
| HEAD | and more...
| |
| |
______________
NICK

我该如何定位它?

对不起我的英语不好,我来自波兰! D:

在这里 fiddle :http://jsfiddle.net/masgp4fg/

最佳答案

试试这个 CSS:

.wrapper { 
background:#EFEFEF;
margin: auto;
;
text-align: center;
position: relative;
margin-bottom: 20px !important;
width: 540px;
padding-top: 5px;
}
.scrolls {
overflow-x: scroll;
overflow-y: hidden;
height: 150px;
white-space:nowrap
}
.scrolls div{
display: inline-block;
margin-right: 2em;
margin-left: 2em;
}
.imageDiv img {
margin: 2px;
max-height: 100px;
cursor: pointer;
display: inline;
*display:inline;
*zoom:1;
vertical-align:top;
}

还有这个 html:

  <div class="wrapper">
<div class="scrolls">
<div>
<img src="http://avatar.hivemc.com/avatar/aruturek/100" /><br>aruturek
</div>
<div>
<img src="http://avatar.hivemc.com/avatar/aruturek/100" /><br>aruturek
</div>
<div>
<img src="http://avatar.hivemc.com/avatar/aruturek/100" /><br>aruturek
</div>
<div>
<img src="http://avatar.hivemc.com/avatar/aruturek/100" /><br>aruturek
</div>
</div>
</div>

此处的 JSfiddle 示例:http://jsfiddle.net/btz4sfsr/

关于javascript - CSS - 定位滚动 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26801079/

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