开发者

CSS centering text between two images

开发者 https://www.devze.com 2023-01-02 17:32 出处:网络
I need to display two images and some text like so: ------------------------------------------ img1--------some centered text-------img2

I need to display two images and some text like so:

------------------------------------------
img1--------some centered text-------img2
------------------------------------------
    开发者_Python百科
  • img1 and img2 are not the same dimensions, but their widths are very close
  • The text is variable depending on the page in which it is displayed, and may include two lines instead of one.
  • The text needs to centered horizontally between the two images, or between the outside of the container (either will be fine)
  • the text AND the images need to be centered vertically within the container.

I can do this VERY easily with a table, but I'd rather not retreat to that for layout. The position:inline-block and display:table-cell attributes work great in some browsers, but I need to support IE6+.


<style type="text/css">
#image1 { float: left; }
#image2 { float: right; }
#text { text-align: center; }
</style>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号