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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:45:40+00:00 2026-06-03T19:45:40+00:00

My CSS file below sets width 50px for style myButton, and accordingly the element

  • 0

My CSS file below sets width “50px” for style “myButton”, and accordingly the element is correctly created with width 50px.

The issue is managing the element from Java (GWT). The following lines:

MyFile.java

final Element box1 = DOM.getElementById("myButton");
String test=box1.getStyle().getWidth();
box1.getStyle().setWidth(100, Unit.PX);
String test2=box1.getStyle().getWidth();

have as a result test=”” and test2=”100px”, and element is correctly resized to 100px.
Why doesn’t test have any value?

Thanks,

MyFile.html

<div style="width: 100%"> 
  <a  id ="myButton" href="#" class="myButton" style="text-decoration: none">Hey</a>    
</div>

MyFile.css

.myButton {
    display:block;
    padding: 10px;
    font-family:"Garamond 3 W01","Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;/*"Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;*/
    font-size: medium;
    color: #000000;
    text-align: center;
    border-radius: 8px;
    background-color: #E7E7E7;
    background-image: url('bar1.png');
    border-bottom: 1px solid #BBB;
    border-top: 1px solid #BBB;
    box-shadow: 0 0 6px 0 #B3B2B7;
    text-shadow: 0 1px 0 white;
    width: 50px; 
    height: 30px;
    margin: 10px 10px 10px 10px;
}
  • 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-03T19:45:41+00:00Added an answer on June 3, 2026 at 7:45 pm

    Element#getStyle() returns the same as JavaScript’s element.style, i.e. the style applied inline to the element (via its style="" attribute).

    GWT does not emulate getComputedStyle or similar; if you really need them (which is unlikely; you should probably refactor your code instead), then you’ll have to use JSNI.

    See https://developer.mozilla.org/en/DOM/element.style

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

Sidebar

Related Questions

When we define a style class like the below in a CSS file, it
We include the CSS file via standard HTML STYLE tag. Then we need the
I have a CSS file, which contain the style information of my web. Some
1) If inside CSS file we specify the following style: td { text-align:center; }
We can declare the character encoding in an INDIVIDUAL CSS file by codes below:
In my CSS file, I have defined a class as given below. input.entryFormInputBoxColor:focus {
I want to define the style of Div based on a CSS file. The
in a css file of a project I see this below code: { behavior:
I have a generic css style defined for table,tr,td in external css file as
Im really stuck. I want a CSS animation I have created (below) to activate

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.