兩個不同的背景,我想這樣的形象創造的東西三角形,使在HTML和CSS
我試圖用兩個div創建兩個不同的三角形,並設法砸碎他們合力得到實現這一點,但不要」不知道如何把文字放在它們上面,使它看起來像這個圖像。我甚至不確定這種方法是否正確。任何改進將不勝感激。
#top {
width: 0;
height: 0;
border-top: 300px solid tomato;
border-right: 600px solid transparent;
display: inline;
display: table-cell;
position: relative;
}
#bottom {
width: 0;
height: 0;
border-bottom: 300px solid skyblue ;
border-left: 600px solid transparent;
display: inline;
display: table-cell;
position: absolute;
top: 8px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="top">
</div>
<div id="bottom">
</div>
</body>
</html>
你在找一個負責任的解決方案,或者元素具有固定的si澤? – fcalderan
響應式解決方案是我之後的一個 – knight