How to absolutely position the baseline of text in HTML

后端 未结 4 1890
别跟我提以往
别跟我提以往 2021-01-17 19:23

I\'m puzzled by the following problem. I wish to (absolutely) position the baseline of some piece of HTML text at a certain y-coordinate, while the text should be starting a

4条回答
  •  一生所求
    2021-01-17 19:58

    Hacky solution based on this blog post.

    HTML:

    
      
    css=powerful

    CSS:

    body {
      margin: 0;
    }
    #text {
      font-size: 30px;
      line-height: 0px;
      margin-left: 100px;
    }
    #text:after {
      content: "";
      display: inline-block;
      height: 120px;
    }
    

    JsFiddle. The basepoint is aligned to (100, 120).

提交回复
热议问题