简体   繁体   中英

CSS - How to set height of absolute div same with neighbor image?

在此处输入图片说明

I got two DOM elements in (A) relatively positioned <div>

One of them is (B) responsive image and the other is (C) absolutely positioned <div>

I'd like to to align (C)'s content vertically centered in (A) 以使(C)的内容垂直居中于(A)

Here is JSFiddle code

I'd like to find method which uses , not the javascript. 使用而不使用javascript的方法。

you have given teh height 100px and width 100% . But the height must be 100% and i give the width 60%. And to get center the div i give left 20%. Because width = 60% left = 20% and right 20% then 60% + 20% + 20% = 100%

This is the fiddle

http://jsfiddle.net/avrkmhfq/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM