English 中文(简体)
CSS 帮助:对形象的定位
原标题:CSS Help: text positioning over image

我的图像为1000x1000。 关于形象,我要说的是“A”信。 详情如下:

  • Bottom value is 160 (meaning, the bottommost part of the "A" is sitting 160px from the top of the image)
  • Left value is also 160 (meaning, the leftmost part of the "A" is sitting 160px from the left of the image)

我需要这样作。 图像缩小到其原尺寸的50%,而底部和左面的数值应达到80和80。 (从此,我举出160px为例,这样可以很容易地转换为em<>>>>。)

图像很可能需要放在自己的集装箱内,因为它也需要放在网页上。 但现在我只需要帮助把信放在形象上。 感谢您提供的任何指导。

最佳回答

使用有背景图像和文字的散射器。 案文的立场。

i.e

<div id="imageHolder"><span class="imageText"> some text</span> </div>

#imageholder {
width: 1000px;
height: 1000px;
background: transparent url(path/to/your.img) 0 0 no-repeat;
position: relative;
}
.imageText {
position: absolute;
top: 160px;
left: 160px;
 } 

您可以将百分比用于上下级,并在提升时留下价值。 http://jsfiddle.net

问题回答

根据我的意见,只是使用背景形象和一些dding子:

http://jsfiddle.net/Xzbcy/。

我和塞卜的共同努力:

http://jsfiddle.net/Gg29e/4/"rel=“nofollow> http://jsfiddle.net/Gg29e/4/

如果图像不成像,那么你可以尝试像这样的东西(我没有经过测试)。

  • Enclose the image in a div
  • Make height and width of the div auto so it gets the height and width of the image
  • Place your text in a span and give it a higher z-index than your image (say z-index 2 for the span and 1 for the image)
  • You can then place your span relative to the div and it should appear on top of your image.




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!