I am trying to auto center text from top to bottom and from left to right, in other words text needs to be in a center of the image. The only thing i can change is css, the code tags are hard coded, so it can’t be changed.
<style>
code {
background:url(http://pad1.whstatic.com/skins/WikiHow/images/header.png) no-repeat -220px 0;
width:403px;
height:56px;
line-height:1.1em;
text-align:center;
padding-top:56px;
padding-left:60px;
padding-right:40px;
}
</style>
<code>message goes here</code>
You need to set the display to block for the
<code>, which is an inline element, so that width and height apply, and better do it the automatic centering way instead of hardcoding any padding sizes:Sample in http://jsfiddle.net/bx852/7/
result: