简体   繁体   English

将伪元素:: after与多行文本对齐

[英]Align pseudo-element ::after with multiline text

I'm having to following code: 我必须遵循以下代码:

 .container { width: 150px; background-color: yellow; } a { font-size: 14px; } a:after { content: "\\003e"; font-size: 32px; font-weight: 700; padding-left: 10px; } 
 <div class="container"> <p> <a>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</a> </p> </div> 

I'm trying to align the horizontal center baseline of an a::after element with the last line of a multiline text. 我正在尝试将a::after元素的水平中心基线与多行文本的最后一行对齐。

I've tried to use flexbox but this will center the ::after element with the horizontal baseline of the complete multiline text instead of the last line. 我尝试使用flexbox,但这会将::after元素与完整多行文本的水平基线而不是最后一行居中。

Here's an example of my problem: 这是我的问题的一个例子:

JSFiddle JSFiddle

you can add position:relative and top:5px to a::after 您可以将position:relativetop:5pxa::after

 .container { width: 150px; background-color: yellow; } a { font-size: 14px; } a:after { content: "\\003e"; font-size: 32px; font-weight: 700; padding-left: 10px; position: relative; top: 5px; /* change the value to what fits you better */ line-height:0 } 
 <div class="container"> <p> <a>Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</a> </p> </div> 

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

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