1110
1110

Reputation: 6829

Dotted border around ASP.NET Button

enter image description here

I have a problem with asp:button styling. I added following style:

.myAspButton    {
        background-image: url("image for button");
        width: 110px;
        height: 25px;
        color: white;
        font-weight: bold;
        vertical-align: middle;
    }
<asp:Button ID="btnAsp" runat="server" Text="hhh" CssClass="myAspButton" BackColor="Transparent" BorderStyle="None" />
  1. Problem is when I press button it gets that dotted border around how to remove this?
  2. And also what property to use to change button style when button is pressed down?

Upvotes: 2

Views: 2227

Answers (4)

user416752
user416752

Reputation:

This is a little old, but none of these solutions worked for me in Firefox.

I now have a solution to this using Javascript. Just add onfocus="this.blur();" to your asp:Button tag...

<asp:Button ID="btnAsp" runat="server" Text="hhh" CssClass="myAspButton" BackColor="Transparent" BorderStyle="None" onfocus="this.blur();"/>

Upvotes: 0

anothershrubery
anothershrubery

Reputation: 20993

This is the outline css property. You can set it just like border.

However, the outline property can be beneficial for people tabbing through controls to see which control currently has focus.

As for the second part of your question, this is not possible with CSS alone. You will need to implement some javascript to change the class on mouse down.

Upvotes: 1

Max
Max

Reputation: 1334

outline: 0; 

Upvotes: 6

Tim B James
Tim B James

Reputation: 20364

Have you tried adding this to the css style?

border: none;

Upvotes: -2

Related Questions