How to absolutely position the baseline of text in HTML

后端 未结 4 1933
别跟我提以往
别跟我提以往 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 20:08

    jsFiddle Goofy (and crazy ugly/hacky), but it works.

    
        
    css=powerful

    ...

        body {
            margin: 0px;
        }
    
        #spacer {
            float: left;
            width: 190px;
            height: 100px;
            background-color: red;
        }
        #baseline {
            visibility: hidden;
        }
        #text {
            float: left;
            background-color: yellow;
            font-family: helvetica, arial; /* may vary */
            font-size: 60px;               /* may vary */
        }
    

    Edit I guess, really, it's all about the image. So you could just simplify and use a transparent spacer gif. Still stupid hacky, I know. jsFiddle

提交回复
热议问题