简体   繁体   English

对角div边框CSS与背景图片

[英]Diagonal div border css with background image

I'm trying to get 2 div's next to eachother with a diagonal space between them. 我正在尝试使2 div彼此相邻,并且它们之间有对角线间隔。 I've seen multiple tutorials en stackoverflow's about diagonal divs, but they all do this by using 2 borders for the div with a solid color and use the diagonal line those create. 我已经在stackoverflow上看到了关于对角线div的多个教程,但是它们都是通过使用纯色的div使用2条边框并使用它们创建的对角线来实现的。 But I want to have pictures/background image instead of a solid color. 但是我要有图片/背景图像而不是纯色。 And maybe even other content like text that go's under the diagonal line. 甚至其他内容(如文本)也位于对角线下方。 And that's not possible when using borders, as a border is outside the div. 使用边框时,这是不可能的,因为边框在div之外。 (floatright with overflow hidden or something for the content.) (带有隐藏的溢出内容或内容的浮动内容。)

Could anybody here give me a hint how to achieve this? 有人可以给我一个提示如何实现这一目标吗? My tests all ended with nothing close to wat I want. 我的测试全部以我想要的扫管ended结束。 Something like this: 像这样:

在此处输入图片说明

Thanks a lot if anybody could point this out for me. 非常感谢任何人能为我指出这一点。

add following style to the second image 在第二张图片中添加以下样式

 <style> .img2{ margin-right:-10px; } <style> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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