请问大侠我想写一个代码,CSS如何给这个小方框的左上角加一个这个的图标,求CSS代码。

html-css08

请问大侠我想写一个代码,CSS如何给这个小方框的左上角加一个这个的图标,求CSS代码。,第1张

首先你要有这个角落的图片,一般是背景透明,然后css只要

position: absolute

top: 0

right: 0

width: xxpx

height: xxpx

background: url(...)

这个图就能跑到右上角了,注意父div position设为relative。

html里怎样实现div左上角标注hot方法:

1、CSS部分修改:

.hot_play{ position:relative}

.hot_play ul{ float:left}

.hot_play li{ float:left position:relative width:95px margin:4px 19px 16px 0overflow:hidden}

.hot_play a img{ width:86px height:120px padding:2px border:1px solid #cfcfcf}

.hot_play a:hover img{ border-color:#8ECFF9}

2、定义好图片的坐标也可以:

<img src="static/images/ghot.gif" style="position:absolutez-index:1001margin-left:380pxmargin-top:1px">

.hot_play span{display:block width:35px height:34pxposition:absolute left:0px top:0px}

.hot_play span.back{ background:url(images/hot.gif) no-repeat }

3、主页部分修改:

<div class="hot_play">

<ul>

<li>

<a href="/"><img src="/" alt="/"></a>

<span class="back"></span>

</li>

</ul>

</div>