Css 在盒子中定位图像

Css 在盒子中定位图像,css,html,position,Css,Html,Position,我的问题是,我不能同时定位两个分区。我想要一个白色背景框,日期在右上角。图像的高度应与日期相同 这是我的代码: #boxx { background-color: white; width: 768px; -moz-box-shadow: 5px 5px 5px #000; -webkit-box-shadow: 5px 5px 5px #000; box-shadow: 5px 5px 5px #000; padding-left: 5px; padding-top: 5px

我的问题是,我不能同时定位两个分区。我想要一个白色背景框,日期在右上角。图像的高度应与日期相同

这是我的代码:

#boxx {
background-color: white;
width: 768px;
 -moz-box-shadow: 5px 5px 5px #000;
    -webkit-box-shadow: 5px 5px 5px #000;
    box-shadow: 5px 5px 5px #000;
padding-left: 5px;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 5px;
margin-top: 30px;
font-family: Tahoma;
font-size: 10pt;
}
#date{
text-align: right;
color: #d50a0a;
position: relative;
}

#image{
margin-left: 5px;
position: float;
margin-bottom: 5px;
margin-right: 5px;
}
当我尝试时,图像总是在日期下方一行。如何解决这个问题?

而不是将

position:float;
试一试

float:left;

(或根据需要向右)

将boxx的位置设置为相对位置,将日期的位置设置为绝对位置。然后右上角0表示日期