Chrome displaying an extJs Button image

Could it be that Chrome is evolving into the new IE in terms of CSS issues?

Here is the code I have for creating ExtJS buttons within an accordion:

var button = Ext.create('Ext.Button', {
    text: '<img src="'+resp.sellers.external[key].catalogs[0].logo+'">',
    handler: function() {
        openOciCall(resp.sellers.external[key].catalogs[0].catId, me.queryFilterManager.getValue())
    },
    margin: '3 3 0 3',
});

In Firefox and IE, everything looks fine like this:

But in Chrome, without the height property, it doesn't look good:

And when I add the height property, it ends up looking like this:

var button = Ext.create('Ext.Button', {
    text: '<img src="'+resp.sellers.external[key].catalogs[0].logo+'">',
    handler: function() {
        openOciCall(resp.sellers.external[key].catalogs[0].catId, me.queryFilterManager.getValue())
    },
    height: 55,
    margin: '3 3 0 3',
});

Resulting in this:

The issue seems to be that ExtJS generates a padding value in Chrome, which distorts the image...

<span id="button-1128-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on" style="line-height: normal; padding-top: 27px;"><img src="logos/logo_mercateo.png"></span>

Now my question is, is there a better approach to display the image correctly in Chrome as in Firefox?

EDIT:

When I try to use the icon element instead, I encounter this issue:

Answer №1

A more efficient way to showcase an image on your button is by utilizing the relevant icon parameters provided for the Button class :

 var button = Ext.create('Ext.Button', {
                    text: ' ',
                    iconCls:'btImage',
                    handler: function() {
                        openOciCall(resp.sellers.external[key].catalogs[0].catId, me.queryFilterManager.getValue())
                    }   
                    ...

                });

Required CSS:

btImage {
background-image: url(/images/logo.png) !important;
}

Note: This code has not been tested.. however, you can experiment with icon, iconCls, and iconAlign parameters to achieve your desired outcome

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can you explain the steps to implement this feature in a modal window using jQuery?

My HTML list contains a bunch of li elements. ul li img .det li I am looking to create a modal popup that appears when I click on something. I want this modal popup to have previous and next buttons, preferably implemented using jQuery. I have alr ...

Columns that adapt to different screen sizes while maintaining a fixed aspect ratio, limited to a maximum of two columns

I'm facing a challenge trying to blend a few elements together: My goal is to have two columns take up 100% of the browser width with a height that adjusts relative to this width. I want these columns to switch to one column when the viewport is sma ...

The alignment of CSS boxes at the top is off

My challenge is to stack 3 containers horizontally, but they have different heights and the smaller ones end up at the bottom. How can I resolve this issue? This is the code snippet I am currently using for the boxes: .brand{ border: 1px solid black; bor ...

Is it possible to extract data from a table by adjusting Javascript in the inspector tool? The page is only showing today's data, but I'm interested in retrieving historical data by going back

My Desired Action: I am interested in extracting data from the 2nd and 3rd tables on this page. However, the data displayed is specific to the current 'day'. I wish to access readings from September 1st and import them into a Google Sheet. Speci ...

What are the reasons behind the jQuery file upload failing to work after the initial upload?

I am currently utilizing the jQuery File Upload plugin. To achieve this, I have hidden the file input and set it to activate upon clicking a separate button. You can view an example of this setup on this fiddle. Here is the HTML code snippet: <div> ...

Ensure that test cases in Angular2 include a line that covers conditions for returning values

I'm having trouble implementing test coverage for an online platform, as I'm not sure how to approach it. Within my service method, I have the following code: public getResults() { return this.http(url,body).map(this.mapResponse); } private ...

Sharing variables between different routes in ExpressJS

Currently, I am utilizing ExpressJs with Node.js and have organized all my routes in a 'routes' folder. When setting up the server, my process involves establishing a DB connection followed by defining the routes as shown below: var routes = re ...

Mastering hot reloading in React when using Dotnet and DockerorAchieving seamless hot reloading in

I have been working on getting hot reloading to function properly with React, Docker, and Dotnet. However, my research has shown that only static rendering is compatible with Docker. As a result, I find myself having to run the command docker -t build {Na ...

What could be causing the input field state to remain static even as I type in the MUI textField?

In my React.js component, I am facing an issue where the textField is not updating when I try to type anything. Upon debugging, I discovered that when the first character is entered, the component re-renders and loses its previous state, causing the textF ...

The server is unable to create the directory at wp-content/uploads/2022/12. Does the parent directory have the necessary write permissions?

i am attempting to incorporate a wordpress media selector into my plugin for wordpress. however, i encountered the following error : Unable to create directory wp-content/uploads/2022/12. Is its parent directory writable by the server? error i made chan ...

Access the value of a JSON property, return null if the key is not found, all in one line of JavaScript code

How about a fun analogy in Python: fruits_dict = {"banana": 4, "apple": 3} num_apples = fruits_dict.get("apple", None) num_oranges = fruits_dict.get("orange", None) print(num_apples, num_oranges) The result would be: 3 None If we switch gears to Jav ...

Ways to ensure that ng-click is triggered exclusively on the click event

I am a beginner in Angular and attempting to toggle a class on click only for the current link. However, when I click, it is affecting all links instead of just the current one. I would like it to work only on the current element, similar to how we use "(t ...

Issue with template updating when utilizing ui-router and ion-tabs in Ionic framework

CODE http://codepen.io/hawkphil/pen/LEBNVB I have set up two pages (link1 and link2) accessible from a side menu. Each page contains 2 tabs: link1: tab 1.1 and tab 1.2 link2: tab 2.1 and tab 2.2 To organize the tabs, I am utilizing ion-tabs for each p ...

Make the text within the CSS style of ".well" wrap around the width

I am looking to style the width of a .well class to be in proportion with the text inside a simple textbox that it contains. What is the best approach to achieve this sizing using CSS? ...

Implementing a progress loader in percentage by simultaneously running an asynchronous setTimeout counter alongside a Promise.all() operation

I'm encountering a problem running an asynchronous setTimeout counter simultaneously with a Promise.all() handler to display a progress loader in percentage. Here are the specifics: I've developed a Vue application comprised of three components ...

Having trouble with the clear button for text input in Javascript when using Bootstrap and adding custom CSS. Any suggestions on how to fix

My code was working perfectly until I decided to add some CSS to it. You can view the code snippet by clicking on this link (I couldn't include it here due to issues with the code editor): View Gist code snippet here The code is based on Bootstrap. ...

Leveraging javascript to extract data from several input fields and dynamically incorporate them into a table

I'm currently in the process of developing a script that extracts field values and organizes them into a table for verification purposes. The challenge I face is that users have the ability to add multiple fields (up to 5), each with its own unique id ...

Updating the parent's reference from a child component in Vue 3

In one of my child components, I have a component named Navbar that includes an option for logging out. <a @click="(event) => {event.preventDefault();}"> Logout </a> This Navbar component has been imported into my parent compon ...

Creating a dynamic link in Vue JS is a cinch!

I currently have the following code snippet: <b-dropdown text="Select Factory" block variant="primary" class="m-2" menu-class="w-100"> <b-dropdown-item @click="selectedFactory='China'"> ...

Trying out a React component that relies on parameters for connection

Having an issue while attempting to test a connected react component that requires a props.params.id in order to call action creators. During the testing process, when checking if the component is connected to the store, an error "Uncaught TypeError: Canno ...