Stefan P.
Stefan P.

Reputation: 331

My CSS doesn't work

i want to apply the following class to my image element :

.laptopimage {
    width: 115px;
    height: 93px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 10px solid black;
} 

my code in aspx.cs file :

Image image=new Image();
image.ImageUrl="~/Images/"+p.ImagePath;
image.CssClass = "laptopimage";

the resulted html code :

<img class="laptopimage" src="../Images/Laptop1.jpg"></img>

I can't understand why it doesn't apply css. The image is still displayed 1700x1700; Can someone explain why this is happening ?

Upvotes: 0

Views: 60

Answers (1)

Kamlesh Meghwal
Kamlesh Meghwal

Reputation: 4972

modify your css and try with this. Some other css might be overiding your laptopimage class

.laptopimage {
    width: 115px !important;
    height: 93px !important;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border: 10px solid black;
} 

Upvotes: 2

Related Questions