Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7608861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:01:48+00:00 2026-05-31T01:01:48+00:00

I am having problem aligning text vertically at the top of the span. vertical-align:

  • 0

I am having problem aligning text vertically at the top of the span.

vertical-align: top; text-top etc…do not work and it is span which is display: inline-block.

Please have a look at the code and a snapshot of the output.

The output looks more like center aligned and not top aligned.

Would be greatful if someone could help.

<span id="myspan" contenteditable="true" style="font-size:30px;" 
                                                        class="textImage" >
     This is text inside the span
</span>
<button id="mybutton" type="button">Increase Font</button>

css:

  .textImage
{
    border: solid 4px #000000;
    min-height: 20px;
    min-width: 240px;
    display: inline-block;
    font-family: Arial;
    color: red;
    vertical-align: text-top;
}​

Javascript:

$("#mybutton").click(function(event) {
    document.getElementById("myspan").style.fontSize = 
                  (parseInt(document.getElementById("myspan").style.fontSize, 10)
                                                    + parseInt(4, 10)) + 'px';
});​

snapshot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:01:49+00:00Added an answer on May 31, 2026 at 1:01 am

    Most fonts take up more height for each character than that visibly taken by say the character T. You’ll be able to see this clearly if you select some text. The height of the selection should give you an idea about the actual height of each character in the font you’ve used. If the selection highlight is seen as touching the inside top of your span, that means the text is indeed top aligned. If you notice any gap between the top of the selection and the inner top of your span, you should be able to correct that by removing any padding-top given to the span.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem aligning an image to the top the text in an
Having problem in IE8 with vertical align for images not working when a table
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
We're having problem with a huge number of legacy stored procedures at work. Do
For some reason, I'm having difficulty aligning ImageView's to the top of the activities
I am having a slight problem aligning my Horizontal Navigation bar to the center
i having problem with sessions in localhost, the problem is the session doesn't work
i having problem understanding what is wrong with my inheritance. I just can not
Iam having problem creating postgresql function in plperl CREATE OR REPLACE FUNCTION zm_json (TEXT,
I am having a problem with the aligning of an image (float left) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.