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 6991279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:28:41+00:00 2026-05-27T19:28:41+00:00

I am creating a span in javascript to append to a td. Works great.

  • 0

I am creating a span in javascript to append to a td. Works great. However, for some reason when I call

document.getElementById("myTd").appendChild(thisNewSpanObject);

the new span seems to think it is a child of the window. So when I set the attribute of

top:-10px;

the span is actually off the page, yet aligned horizontally with where it should be, when in reality, I just want it to display 10 pixels above where it would load if it did not have the css property assigned to it. Should I be using something other than top here? If I don’t use top then the span loads right in place, 10 pixels too low (position:absolute; is set).

  • 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-27T19:28:42+00:00Added an answer on May 27, 2026 at 7:28 pm

    Add position: relative to the span element.

    You are currently using position: absolute, meaning it will be relative to its nearest ancestor with something besides position: static (the default for elements) or the document.

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

Sidebar

Related Questions

//dom <div id='toBeCloned'><span>Some name</span></div> <div id='targetElm'></div> //js $(function () { //creating a clone var
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
I noticed that some of developers in our team are creating long jQuery selectors
Walter Rumsby provided a great answer to Where to place JavaScript in an HTML
I'm having trouble creating a Gridview that can span 2 rows for each record.
I am creating list of <span class=infa9span><img src=/csm/view/include/images/foldericon.png/><a id=infa9Service>'+servicename+'</a><br/></span> tags dynamically and appending it
I am creating an element on my page like so: <a href=> <span class=benefits>
I'm creating a website where I'm doing ajax requests to load some dynamic content
I am creating a extension for Internet Explorer where I am injecting CSS-styled span
I am dynamically creating a bunch of buttons <a href=# id=btnRemove class=ui-state-default ui-corner-all><span class=ui-icon

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.