tomouse
Technical User
- Aug 30, 2010
- 50
I manage a multilingual website and am trying to replace my ASP imagebuttons with CSS versions. Currently, each time we add a new button we have to create 2 new graphics (One with the text in English, the other in Portuguese) - it would be far better to do away with these graphics that include text and replace with a CSS button with actual text for the label.
I have managed to create a button which displays correctly when I place actual text inside (I gather the term for this technique is 'sliding doors' - as the length of string changes, the button alters to fit):
(I have put the CSS at the bottom of this post).
However, because this is a multilingual site, I cannot hard-code in the button text. I need to use a control that can be referenced by the server's resource files to insert text from the selected language at runtime:
But the problem with this is that the label somehow duplicates a small section of the top-left corner into the middle of the button - I don't understand why. I've been messing around with the CSS values (the CSS below shows the two versions of the span styling), but I can't get this to display in the same way as when I just have the text hardcoded as in the first example. Can someone help me get this positioned properly? The 'button_left' graphic is a 300px wide by 20px high; button_right is 18px wide by 20px high.
Here is the CSS
I have managed to create a button which displays correctly when I place actual text inside (I gather the term for this technique is 'sliding doors' - as the length of string changes, the button alters to fit):
Code:
<a id="imbSearch3" class="buttonO" href="#"><span>Button Text</span> </a>
(I have put the CSS at the bottom of this post).
However, because this is a multilingual site, I cannot hard-code in the button text. I need to use a control that can be referenced by the server's resource files to insert text from the selected language at runtime:
Code:
<a id="imbSearch2" class="buttonO" href="#"><span><asp:Label ID="lb1" runat="server" Text="<%$ Resources:ResourceFilename, stringKey %>"/></span> </a>
Here is the CSS
Code:
a.buttonO {
background: transparent url('../img/button_right.png') no-repeat scroll top right;
color: White;
display: block;
float: left;
font: bold 12px Trebuchet MS, sans-serif;
height: 20px;
margin-right: 6px;
padding-right: 18px;
text-decoration: none;
}
/* This is the closest I can make for the aspLabel version */
a.buttonO span {
background: transparent url('../img/button_left.png') no-repeat;
display: block;
line-height: 10px;
padding: 2px 0 3px 10px;
}
/* This is the one that works for the hardcoded text version */
a.buttonO span {
background: transparent url('../img/button_left.png') no-repeat;
display: block;
line-height: 10px;
padding: 2px 0 3px 10px;
}