html - Text over the top of a border-image: Using the border as an expandable background -


i'm trying create expandable background image text. border-image property gives me want. problem don't want border, more border becomes background content (specifically fixed resolution edges , stretching centre). setting height 0 gives exact background want, unfortunately text dropped below centre:

height: 0px; display: inline-block; font-size: 100pt; border: 149px; border-image: url('img.png') 149 149 stretch; 

edit: firefox border: solid 149px;

http://jsfiddle.net/rl798/

  1. what's simplest way shift text up?
  2. is there simple way add negative offset width bring border sides in?

this great example believe negative padding provide perfect solution.

i'm aware there's many other ways achieve same result (eg standard background image , 2 elements either side), i'm after small , simple.

you use line-height:

http://jsfiddle.net/jonigiuro/rl798/4/

div {     height: 0px;     display: inline-block;     font-size: 100pt;     border: 149px;     border-image: url('http://upload.wikimedia.org/wikipedia/commons/thumb/b/bb/button_icon_greenblue.svg/300px-button_icon_greenblue.svg.png') 149 149 stretch;     line-height: 20px; } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -