如何使用图层定位图形按钮

时间:2012-11-29 14:33:37

标签: css

我有这个页面(下面),我想在屏幕截图的右下角(价格右侧)放置一个图形按钮

如何使用几行代码完成此操作?

截图:

enter image description here

代码:

<div class="content-1g">
    <div class="content-1-1g">
        </div>
    <div class="content-1-2g"><p class="none"><%# Eval("TName")%></p>
            <div class="content-1-3g"><p><%# Eval("TDetails")%></p></div>
            <div class="content-1-3g">Adult: £<%# Eval("TPriceadult")%> </div>
            <div class="content-1-3g">Senior/Student: £<%# Eval("TPricesenior")%> </div>
            <div class="content-1-3g">Child: £<%# Eval("TPricechild")%> </div>
    </div>
</div>

CSS:

.content-1g {
    float: left;
    width: 836px;
    padding: 0px 32px 0px 32px;
/*  background-color: White;
    border: 1px solid orange; */
}

.content-1-1g 
{
    float: left;
    width: 269px;
    height: 202px;
    margin:0px 20px 0px 0px;
    padding: 0px;
    background: url('../images/Chinatown-experience-logo.png') no-repeat left top;
}

.content-1-2g {
    float: right;
    /*width: 591px; */
    width: 547px;
    padding: 0px 00px 0px 0px;
    font: 100% "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
    color: #FFFF00;
    text-align: justify;
    vertical-align: top;
}

.content-1-3g {
    float: right;
    /*width: 591px; */
    width: 547px;
    padding: 0px 00px 0px 0px;
    font: 100% "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
    color: #FFFFFF;
    text-align: justify;
    vertical-align: top;
}

由于 茶

3 个答案:

答案 0 :(得分:0)

带有“唐人街”标题的那个是按钮吗?

您可以将其定位为绝对值,并为其设置右侧和底部值:

position: absolute;
right: 10px;
bottom: 10px;

答案 1 :(得分:0)

我认为您需要将产品规格拆分为两个div并左右浮动。像这样:

<div class="content-1g">
<div class="content-1-1g">

</div>
<div class="content-1-2g">
    <p class="none"><%# Eval("TName")%></p>
    <div class="content-1-3g"><p><%# Eval("TDetails")%></p></div>
    <div class="content-left">
            <div class="content-1-3g">Adult: £<%# Eval("TPriceadult")%> </div>
            <div class="content-1-3g">Senior/Student: £<%# Eval("TPricesenior")%> </div>
            <div class="content-1-3g">Child: £<%# Eval("TPricechild")%> </div>
    </div>
    <div class="content-right">
        <!-- Your button -->
    </div>
</div>

对于CSS:

.content-left {
    float: left;
    width: 273px;
}

.content-right {
    float: left;
    width: 273px;
}

在按钮宽度处调整右边div的大小。希望它有所帮助!

答案 2 :(得分:0)

将此按钮放在文本的末尾,然后:

.your_button {
    float: right;
    display: block;
    clear: both;
}