我正在嘗試使用2個字符串創建響應式設計徽標,這兩個字符串都略顯透明。琴絃尺寸不同,第二個在第一個之上。CSS:對齊疊加層
我幾乎得到我想要的(下面的HTML爲try),但是我希望2個字符串的右邊緣對齊 - Div擴展到瀏覽器的寬度,並且重疊隨寬度的變化而變化顯示器。
因爲我想給瀏覽器提供它如何呈現的一些選擇,我寧願不使用像素的測量。
如果完全相關 - 我計劃在Div的任何一方添加其他元素。
<!DOCTYPE html>
<html>
<head>
<style>
.outerText {
position: relative;
font-family: Arial,sans-serif;
font-weight: 900;
font-size: 800%;
text-align:center;
letter-spacing: -0.1em;
color: red;
opacity: 0.2;
top: 0;
left: 0;
}
.innerText {
position: absolute;
font-family: Arial,sans-serif;
font-weight: 900;
font-size: 600%;
text-align:right;
letter-spacing: -0.1em;
float: right;
color: blue;
opacity: 0.2;
z-index: 1;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
and the result is....<br />
<div style="position:relative">
<span class="outerText">OuterTxt</span>
<span class="innerText">InnerTxt</span>
</div>
<hr />
...nearly right - but the rt edges are not (necessarily) aligned
</body>
</html>
創建一個jsfiddle,以便我們可以使用您的代碼進行遊戲。 – Cam 2013-05-09 14:08:00
你是什麼意思的右手邊緣? – 2013-05-09 14:09:12
'郵政:絕對;'有一個錯字。 – Blazemonger 2013-05-09 14:16:12