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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:50:47+00:00 2026-05-25T17:50:47+00:00

I have a CSS Class: .ImageBorder { border-style:solid; border-color:Black; } I then set the

  • 0

I have a CSS Class:

.ImageBorder
{
border-style:solid; border-color:Black;
} 

I then set the CSS Class to an asp.net Image:

<asp:Image ID="Image3" runat="server" Height="150px" 
                ImageUrl="~/Photos/defaultA.jpg" CssClass="ImageBorder"  />

But it doesn’t work. It will work if I put the image in a div tag and then set the divs css class, but I’d rather not do this? What gives?

  • 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-25T17:50:48+00:00Added an answer on May 25, 2026 at 5:50 pm

    As noted in other answers, you should specify the border-width. You may experience an additional “gotcha”, though: asp images may have a “border-width:0” inline styling. In which case, your rule would need the !important declaration to override it:

    .ImageBorder
    {
    border: 1px solid black !important;
    }
    

    The !important declaration ignores the normal rules of precedence that CSS follows. Normally, inline styling takes precedence over embedded or external style sheets, which take precedence over the user agent’s styling. An important property will take precedence over all non-important properties, regardless of where it is declared.

    Using !important can lead to some frustration, however. Suppose you wanted to have an image with all the same qualities as your ImageBorder images, but with a width of 100. You might write

    <img src="superBorderedImage.png" class="ImageBorder" style="border-width:100"/>
    

    … But this will not work. You specified with great importance that ImageBorder images have width 1, so your “super bordered image” won’t have its special thick border. For this reason, you should use !important only when you’re certain you won’t need to override it later for special cases.

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

Sidebar

Related Questions

I have a css class like: .foo { background-color: red; } then I have
For example I have this css class: .class{ background:#FFF; border:1px solid #ccc } And
i have div take css class .headbg01 { background-image: url(../images/header_background01.jpg); border-left: #cccccc 1px solid;
I have a css class (given below). The border element is working fine in
I have a CSS class defined, call it: <style type=text/css> .Foo { position: fixed;
I have a css class: input { font-family: Arial, Helvetica, sans-serif; font-size: 10px; border:
I have a CSS class and I wish to set it's width attribute: ul.month-wrapper
HTML: <div class=cell-container> <img src=image.png class=thumbnail /> </div> CSS: .hover { background-color: silver; }
I have created a CSS class as follows: div.ycontent div.ppclisting { background-color:#cccccc; } div.ycontent
I have a css class that is called button.blue: button.blue { background-color: blue; ...

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.