且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何让图像浮动在中心的div旁边?

更新时间:2023-10-24 22:49:04

将图像放置在居中的div中。给中心的div position:relative 。现在给图像 position:absolute left:-XXpx 其中XX是图像的宽度。


How can I make a image float next to a centered box? What would be the correct HTML/CSS-code? Here's a outline of what I'm trying to make:

Thanks in advance.

Place your image inside the centered div. Give the centered div position:relative. Now give the image position:absolute and left:-XXpx where XX is the width of your image.