开发者

html banner with overlaying images and texts

Im looking for a way to dynamically create banners who can get placed on other pages. The banner consists a background image, two over开发者_开发问答laying images and two text labels on top of this background image.

Is it right that I only can use absolute positioning to achieve a overlaying elements? How can I make sure, that the banner in its own gets placed relatively in the integrated page?

I guess I need to be able to place elements absolute inside a relative box. Is this possible?

Thanks Markus


It is possible. The containing element need to have position:relative and all the inner elements that you want to place need to have position:absolute; and also the position x and y like this: top:10px; right:20px or bottom:10px; left:230px

So for example:

CSS:

#banner_wrap {position:relative; width:860px; height:60px;}
#inner_element {position:absolute; top:10px; left:20px; width:40px; height:40px;}

HTML

<div id="banner_wrap">
   <div id="inner_element"></div>
</div>

If you want them to be dynamic then you can change the CSS for the specific page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜