如果它存在于数据库中,我想将文本放在图像上,如果它不存在,我想将它放在相同的位置。
我面临的问题是,如果有图像,则文本位于其下方,如果不存在,则文本将位于正确的位置,如附图中所述。代码如下:
<div class="category">
<img src="home.php?cat={$mc.categoryid}"/>
<div class="title">
<h2>Some text</h2>
</div>
</div>
我想做一些类似的事情:
<style>
.category{
width: 400px;
height: 400px
}
.title {
position: relative;
top: 3px;
left: 0;
width: 100%;
height: 50px;
}
</style>