开发者

Put an X on the topright of a div without making the top clickable

I have a rect and have an X on the top right with items inside of it. The div with the X is clickable. The problem i开发者_JAVA百科s the whole top area is clickable and not just the topright (the 'X') as i wanted. How do i make only the X clickable and still align to the right?

my css is

.itembox 
{
    float:left;
}

.itembox .RemoveMediaNotif
{
    text-align: right;
    text-decoration:underline;
    cursor: pointer;
}

my html is

<div class="itembox" id="i16"><div class="RemoveMediaNotif">X</div><div ...


.itembox .RemoveMediaNotif
{
    float:right;
    text-decoration:underline;
    cursor: pointer;
}

Should fix your problem.


Your outer div has to float left ? Otherwise I'd go (untested ) :

<div class='outer'><div class='x'>X</div></div>

and

.outer {
   //
}
.x {
  float:right;
}


You could absolutely position it from the right. That's what I'd do (I'm assuming it's some sort of close button):

.itembox  
{ 
    position: relative;
    float:left; 
} 

.itembox .RemoveMediaNotif 
{ 
    position: absolute;
    right: 0px;
    top: 0px; 
    text-decoration:underline; 
    cursor: pointer; 
} 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜