Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline stretchy button with CSS background image

Anyone know if there's a bullet-proof (standards-compliant to XHTML1.1 strict, cross-browser, non-javascript) way to use CSS and background images to turn an inline link into a visual button that will stretch to accommodate different amounts of text (or text resizing)?

I'm thinking I need to use background images as the designer's buttons have rounded corners with a different coloured border. It must work in IE6 (Government job).

Im pretty sure the answer is no, but as always thought it worth a check.

Amongst other things, I've already tried variations on the sliding doors technique, but can't make it work as the solution needs to work inline (i.e. within a paragraph) and I can't set a fixed width.

EDIT: There are several buttons, each of which has a different colour for foreground, border and background. They also have a gradient 'face', but no need for transparency or anything else 'unorthodox'. Unfortunately I can't link to examples as I'm under an NDA.

like image 239
da5id Avatar asked May 09 '26 19:05

da5id


2 Answers

I'm not sure if this will fit your needs, but I helped someone with hoverable rounded buttons in this post... it uses only HTML and CSS.

like image 164
Mottie Avatar answered May 11 '26 13:05

Mottie


I don't think you can do this within your restrictions. The problem is that you have one element, but to properly do stretching, you need three (unstretched left side, stretched center, unstretched right side).

like image 35
John Fisher Avatar answered May 11 '26 14:05

John Fisher