Forums

Give help. Get help.

  • # February 7, 2018 at 9:04 am

    hi ,guys

    I have a span tag that a line is bottom of it , I want to get width of each character .

    then for example I want width of line be the same of 2 character of word.

    I want type my word in Persia than in it the character width not equal to itself . thanks

    https://www.imageupload.co.uk/images/2018/02/07/IMG_20180207_192506.jpg

    span{
            margin:0 auto;
            font-size:40px;
            display: inline-block;
            position: relative;
        }
    
    span:after{
        position: absolute;
            content: "";
            border:1px solid #f30;
            left:0;
            top:55px;
            width:45px;
    }
    
    # February 7, 2018 at 3:15 pm

    There isn’t one since, with most fonts, characters are not all the same width.

    The only simple method is to use a monospace font, where all characters ARE the same width.

    Then you can use the ch length.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag