css - 用背景图片填充(达到一定高度)容器 div

标签 css

我有一个容器 div,我在其中放置了两个背景图像,如下所示:

图像已删除

上图的CSS:

#test44{
background-image: url("images/reference_opt.png"),   url("images/content_opti11_opt.png");
background-position: 41px bottom, 82px 25px;
background-repeat: no-repeat, repeat-y;
background-size: 192px 292px, 1097px auto;
margin-bottom:10px;
min-height: 310px;

} 相应的标记:

<div id="test44">
<table>
<tr>
<td class="td">
<div >Reference 1</div></td>
<td>
<div class="content">
Your objective tells a prospective employer the type of work you are currently    pursuing. The rest of your resume should be designed to most effectively support your   objectivekuedyg djkhdbkd jd asjkds dkjdb
</div></td>
</tr>
</table>
</div>

但是我的要求是如下图所示:

图像已删除

最佳答案

与其使用两个背景图片(这不符合逻辑,而且可能很棘手),不如使用两个 div;将最大的容器(即#test44)放在relative位置,对应background-image

然后你将放置另一个用于偏移图像的 div,并将其定位在 absolute 位置(相对于其父级)

这里是一个背景颜色的例子,与图像相同:jsfiddle

关于css - 用背景图片填充(达到一定高度)容器 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20098352/

相关文章:

CSS 网格问题

javascript - 在页面调整大小时记录隐藏元素的高度

html - 使用 CSS 为段落制作右外 flex 层

html - 是否可以重用从 HTMLCanvasElement.toDataURL() 或 canvas.toBlob() 返回的 DOMString?

html - 如何更改 jquery-mobile 中选择列表标题的字体大小?

css - Angular 4 In Code 全局覆盖 Bootstrap 颜色

php - 在网格上的随机位置设置一个 div

css - 从 p :layout 中删除排水沟

css - 防止页脚重叠

html - 600 像素以下左对齐