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

  • Home
  • SEARCH
  • 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 8933943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:40:07+00:00 2026-06-15T09:40:07+00:00

On http://jsfiddle.net/Xs9e2/ there are two elements, named ONE and TWO. The element ONE is

  • 0

On http://jsfiddle.net/Xs9e2/ there are two elements, named ONE and TWO. The element ONE is positioned by assigning to the style property of the DOM element using JavaScript. The element TWO is positioned using CSS.

The HTML renders as expected.

There is a button one can press to have the left and top properties of each of the two elements alerted. We only see the properties that were set in JavaScript, not the ones set in CSS.

What is the reason for this exactly? Shouldn’t we be able to read the CSS properties via JavaScript? I may have specified something incorrectly. I know about the “offset” properties and I know about JQuery; I’m just puzzled why this old-fashioned DOM manipulation isn’t working as I would expect. What am I missing?

  • 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-06-15T09:40:10+00:00Added an answer on June 15, 2026 at 9:40 am

    The style attribute is, well, an attribute. That is you can only access the values given in the HTML element’s attribute style:

    3.2.3.8 The style attribute

    The style IDL attribute must return a CSSStyleDeclaration whose value represents the declarations specified in the attribute. (If the attribute is absent, the object represents an empty declaration.) Mutating the CSSStyleDeclaration object must create a style attribute on the element (if there isn’t one already) and then change its value to be a value representing the serialized form of the CSSStyleDeclaration object. The same object must be returned each time.

    Styles given with CSS don’t set the element’s attribute, thus you cannot access it with .style.

    However, you can use getComputedStyle.

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

Sidebar

Related Questions

http://jsfiddle.net/3V6MM/ Please tell me how can I write common style for class=property-title to display
http://jsfiddle.net/DaJWC/ i can't figure out how to make one of the links reverse so
http://jsfiddle.net/AYPze/9/ In this example I have two similar divs with the same goal. Bind
http://jsfiddle.net/s6Umb/ I'm getting this strange behavior where when I create a datepicker, there appears
http://jsfiddle.net/nicktheandroid/SsfpG/ I don't understand why these inline elements are causing the paragraph to stop
http://jsfiddle.net/gfuKS/5/ var transitionInitial = {property: none}; var rules = [color, background-color]; var transitions =
http://jsfiddle.net/egEq2/ .badge { -webkit-transform-style: preserve-3d; -webkit-perspective: 1000; position: relative; } .back, .front { position:
http://jsfiddle.net/nXqd/qC2Ya/6/ Take a look at the jsfiddle. When I enter wrong data in two
http://jsfiddle.net/3BFGU/71/ Width of the html parent element (calculated using 1$(el).width()1) is less than the
http://jsfiddle.net/LUfgY/ It doesn't show it there but if that code is run on normal

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.