对齐文本中心(减号)10px

J.D*_*.D. 3 css text-alignment

我有一个由1px的高(重复无限期)使用的图像170像素宽的菜单系统,它在左边10px的边界,但右侧的边框30像素.

有没有办法使文本居中,但是在右侧占了额外的20px?

小提琴SiteCode:http://jsfiddle.net/jgallaway81/AXVT5/1/

相关守则:

.menubuttonthin {margin-left:0px; margin-top:0px; margin-bottom:0px; width:170px; height:30px; display:block; line-height:30px; font-family:courier; font-size:small; color:#C8C8C8; text-decoration:none; font-weight:900; background-image: url(../_pic-lib/lcars-frame-button-thin.png); }

<a href="http://www.fccorp.us/index.fccorp.php" class="menubuttonthin"> FCCorp.US Story </a>
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,我没有div'd链接,因为它们由创建菜单区域框的div封装.此外,我已尝试边缘和填充两侧,但所有这一切都是增加teh框的大小,抛弃背景图像,使其与网站的背景图像不匹配.

Ron*_*Ron 7

将文本放入a <div>并使用以下样式:

text-align:center; 
margin-right:-20px;
Run Code Online (Sandbox Code Playgroud)

例如,如果要使用内联样式:

<div style="text-align:center; margin-right:-20px;">

</div>
Run Code Online (Sandbox Code Playgroud)