绝对定位。需要帮助显示 3 张图像而不是 1 张

发布于 2024-08-19 06:36:02 字数 431 浏览 3 评论 0原文

    </div>

<div style="position:absolute;top:160px;left:535px;"><img src="splash.png"></div>
<div style="position:absolute;top:160px;left:535px;"><img src="splash2.png"></div>
<div style="position:absolute;top:160px;left:535px;"><img src="splash3.png"></div>
<!-- Press Logos -->
<div align="center">

我怎样才能让所有三个启动图像水平显示......

    </div>

<div style="position:absolute;top:160px;left:535px;"><img src="splash.png"></div>
<div style="position:absolute;top:160px;left:535px;"><img src="splash2.png"></div>
<div style="position:absolute;top:160px;left:535px;"><img src="splash3.png"></div>
<!-- Press Logos -->
<div align="center">

how can i get all three splash images to display horizontally...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

凶凌 2024-08-26 06:36:02

“水平显示”是指它们彼此相邻地排在一条线上吗?标记中的图像会自然地执行此操作,除非没有足够的空间,在这种情况下,它们会环绕到下面的空间。

<div>
    <img src="splash.png" />
    <img src="splash2.png" />
    <img src="splash3.png" />
</div>

您可以将样式应用于周围的 div 以将图像居中放置等。

此外,您的原始标记示例有一些错误的标记。您的图像标签应该是自动关闭的(即以 /> 结尾,而不是 >)。

By 'Display horizontally', do you mean they sit next to each other on one line? Images in markup will do this naturally unless there is not enough room, in which case they wrap to space below.

<div>
    <img src="splash.png" />
    <img src="splash2.png" />
    <img src="splash3.png" />
</div>

You can apply styling to the surrounding div to position the images centered, etc.

Additionally, your original markup example has some bad markup. Your image tags should be self-closing (I.e. ending in />, not >).

紫轩蝶泪 2024-08-26 06:36:02

你可以

  • 给每个div一个不同的x位置(实际上是最直接的方法)

  • 将它们放入足够宽度的容器中并给容器position:absolute而不是周围的div

You could

  • Give each div a different x position (the most straightforward way, really)

  • Put them into a container of sufficient width and give the container position: absolute instead of the surrounding divs

谁对谁错谁最难过 2024-08-26 06:36:02

尝试将您的代码更改为:

<div style="position:absolute;top:160px;left:535px;">
    <img src="splash.png"><img src="splash2.png"><img src="splash3.png">
</div>

Try changing your code to look like:

<div style="position:absolute;top:160px;left:535px;">
    <img src="splash.png"><img src="splash2.png"><img src="splash3.png">
</div>
还不是爱你 2024-08-26 06:36:02

您还可以使用浮动:

#header
{
     height: 100px; /*or something */
 }
#header img
{
      float: left;
      margin: 20px; /*change the margin(s) as you need */
}

You can also use floats:

#header
{
     height: 100px; /*or something */
 }
#header img
{
      float: left;
      margin: 20px; /*change the margin(s) as you need */
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文