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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:18:13+00:00 2026-06-12T15:18:13+00:00

I have an html img that is being styled by a CSS class. I

  • 0

I have an html img that is being styled by a CSS class. I would like to override the width and height values used in that class under some circumstances.

I’m building this img tag using something called a TagBuilder class, provided by Microsoft for the .Net system, which allows developers to assign attributes to an html element.

In this case a CSS class has been assigned to the img tag, and I can assign width and height attributes individually, but they’re not taking precedence over the values set in the CSS class.

My tag looks like this currently:

<img alt="my link" class="static" height="240" id="StaticImage" src="http://imageserver.com/myImage.jpg" width="240">

The static CSS class has width and height values of 300 each, and as you can see I’m trying to override them with 240. It’s not working in this instance but can I do it without a second CSS class?

  • 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-12T15:18:15+00:00Added an answer on June 12, 2026 at 3:18 pm

    You can add a style attribute to your img:

    <img alt="my link" class="static" height="240" id="StaticImage"
    src="http://imageserver.com/myImage.jpg" width="240"
    style="height:240px;width:240px;">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an html file containing <img width=10 height=12 scr=https://www.site.com/yughggcfgh> <img width=11 height=15 scr=https://www.site.com/yughggcfghcvbcvb>
I have very large HTML that, if being parsed into DOM tree, would take
I have a string that is HTML encoded: '''&lt;img class=&quot;size-medium wp-image-113&quot;\ style=&quot;margin-left: 15px;&quot; title=&quot;su1&quot;\
I have HTML like this: <div> <a href=>sometext<img src=images/001.jpg /></a> <a href=>sometext<img src=images/002.jpg /></a>
I have html like this. <td id=foo> <img src=foo.png /> <img src=foo.png /> <img
On input we have HTML like: <table> <tr> <td> <img ...> </td> <td> <img
I have following HTML <tr id=r1 class=l1> <td><img class=plusminus id=r1c1 src=assets/images/plus.png border=0 />3/10/12</td> <td></td>
I have the following HTML <div id=testID class=test1> <img id=testID2 class=test2 alt= src=some-image.gif />
I have this HTML with a table: <div class=currentDesignDiv style=margin-bottom:5px;> <div> <img alt=Thumbnail src=http://www.propertyware.com/templates/
I have outbound links like this in my html: <a href=http://www.example.com class=gaLink1 target=_blank onCLick=ga_track_link('action',

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.