我有一些代碼,這是爲了使從垂直彎曲邊界如所附圖片顯示的右下方:Psuedo-element text需要垂直調整,需要什麼CSS?
但正如你所看到的,文字是不正確的spot ...授予,它與DIV主要部分的主垂直右壁相距10像素,但頂部的填充不是7px。我已經嘗試使用line-height
來渲染「填充」,但是您在這裏看到的是line-height: 0
......進一步降低並不會讓它變得更高......然而,增加它會將它進一步拉低。
是否有任何我可以渲染此代碼,使得「ELBOW 1」從DIV的頂部出現7px,但仍然保留標記內的文本內容作爲數據屬性?
的jsfiddle:下面https://jsfiddle.net/eliseo_d/b83d9ytL/3/
代碼:
HTML:
<div class="elbow-1-botrt-wide0-grey1" data-text="elbow 1"></div>
CSS:
html {
background-color: rgb(0,0,0);
font-family: Impact;
}
body {
margin: 5px;
}
div[class$='-grey1'] {
background-color: rgb(102,102,102);
}
div[class^='elbow-'] {
/* default settings */
color: rgb(0,0,0);
font-size: 14pt;
height: 67px;
margin-bottom: 4px;
margin-right: 21px;
text-transform: uppercase;
width: 104px;
position: relative;
}
div[class^='elbow-1-'] {
padding-top: 46px;
}
div[class^='elbow-'][class*='-botrt-'] {
border-bottom-left-radius: 42px;
}
/* elbow bar */
div[class^='elbow-'][class*='-botrt-']:before {
content: '';
height: 30px;
left: 104px;
bottom: 0;
position: absolute;
margin-right: 4px;
}
div[class^='elbow-'][class*='-wide0-']:before {
width: 21px;
}
div[class^='elbow-'][class$='-grey1']:before {
background-color: rgb(102,102,102);
}
/* inside curve */
div[class^='elbow-'][class*='-botrt-']:after {
height: 21px;
width: 73px;
bottom: 30px;
left: 21px;
padding-right: 31px;
position: absolute;
content: attr(data-text);
text-indent:-59px;
color: rgb(0,0,0);
text-align: right;
}
div[class^='elbow-1-'][class*='-botrt-']:after {
line-height: 0;
}
div[class^='elbow-'][class*='-botrt-'][class$='-grey1']:after {
background: radial-gradient(circle at 100% 0%, rgba(102,102,102,0) 21px, rgba(102,102,102,1) 21px);
}
更新:由於某些原因的影響字體不渲染正確地在小提琴... Thi旨意不會在我原來的本地代碼的問題,但上面仍然站立的填充問題...
您可能要提供實際的** ** CSS和您實際得到的演示。 –
@Paulie_D我已經提供了JSfiddle和原始問題中的代碼...?你想讓我提供整體的CSS嗎? –
小提琴中的代碼不會渲染你的圖像...也不會嘗試使用數據屬性 –