php - 我如何修改我的 css 代码以像这张图片一样输出

标签 php css

我的 style.php 文件中有这个

.msg{
    text-transform: none;
    text-align: center;
    font-weight: bold;
    color: red;
    border: solid 1px #fc0;
    background-color: #EFEF00;       -webkit-border-radius: 0.3em;
    border-radius: 0.3em;             margin: 6px;
    padding: 6px;
    tex 
}
#header{
    height: 50px;
    background: #decf9c;
    color: black;
    border-bottom: 2px solid       #663333;
    width: 98%;
}
.b_head{
    padding: 6px;
    background: #663333;
    color: #ffffff;
    font-weight: bold;
    text-align: center;
}


.cart {
    background-image: url('http://www.pvhc.net/img180/xewlwqfroahrisfwokkc.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-color: #663333;
    width: 35px;
    height: 35px;
    border: 1px solid #fff;
    outline: 3px solid #8174f7;
    position: absolute ;
    right: 6px;
    center: 6px;
}

.badge {
    position: absolute;
    left: -15px;
    bottom: -15px;
    font-weight: 700;
    font-family: sans-serif;
    font-size: 20px;
    color: #fff;
    background-color: #663333;
    border: 2px solid #fff;
    padding: 3px;
    width: 12px;
    height: 12px;
    text-align: center;
}

.badge:empty{
    display: none;
}

.content{
    background-color: #fff;
    color: #000;
    padding:8px;
    text-align:center;
    margin-top:62px;
}

.red{
    color: red;
}

.info_post{
    background-color: #ffffcc;
    color: #000;
    font-weight:;
    border:1px solid #663333;
    padding: 4px;
    margin-top: 3px;
}

我的 php 文件中有这个

<?php
    require("init.php");
    include"style.php";
    if(isset($_SESSION["cart_array"]) && is_array($_SESSION["cart_array"])) {
        $cart = 0;
        $cartTotal = 0;
        foreach ($_SESSION["cart_array"] as $each_item) {
            $id = $each_item["item_id"];
            $qty = $each_item["quantity"];
            $cart += $qty;
            $sql = mysqli_query($conn, "SELECT * FROM promo WHERE code='$id' LIMIT 1");
            while($row=mysqli_fetch_array($sql)){
                $cartTotal += ( $row["price"] * $qty);
                if($cartTotal > 999) {
                    $cartTotal = number_format($cartTotal);
                }
            }
        }
    }
    echo "<br /><div class='info_post'><b> bulk SMS, and E-xchange market<br /></div>";
    echo "<a href='preview.php'><div class='cart'><span class='badge'>$cart</span></div></a>";
    echo "<div class='content'><div class='b_head'><table><span class='red'><div align='left'><b>#$cartTotal</b></span></div><div align='right'><img src='http://stevendie.xtgem.com/icon/menu/stv1_ceo.png'/><a href='login.php'><b>login</b></a></table></div></div></div>";
    echo "<table><form action='#' method='POST'><div align='left'><b>Check code:</b><br/ ><input type='text' name='book' placeholder='Enter  Username' size='17'> <input type='submit' name='submit' maxlength ='2' size='2' value='PRINT'></form></table>";
?>

目前的输出是这样的:

http://i63.tinypic.com/2h7l55s.png

在我的成就中,我希望它看起来像 DEMO:

enter image description here

提前致谢

最佳答案

尝试添加::

.cart {position: relative;}
.badge {bottom: -30px;}

关于php - 我如何修改我的 css 代码以像这张图片一样输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47649757/

相关文章:

php - Yii2 在控制台模式下捕获异常

php - 在网络开发中存储非必要数据的最佳方式?

php - 如何在ftp上找到最新的最后修改目录

PHP SQL 选择 ID 数组中的位置并且具有相同的变量列值

css - IE 中的 Contenteditable 内联样式

html - 为什么 Content 没有居中对齐?

asp.net - 滚动时如何使asp菜单扩展到页面末尾?

php更改 fatal error 格式

html - last-child 不工作也不显示在 devtool 的 css 元素中

html - 如何在一页上获得多个自动幻灯片?