如何让我的购物车总数浮动到我的标题右侧?

时间:2016-04-25 14:40:16

标签: html css css3

我的Wordpress网站上有一个标题,左侧有一个徽标图像和一个浮动到右侧的登录按钮。我刚刚添加了一个购物车总计链接,我希望它在登录按钮旁边浮动,但是我无法移动它。有人可以帮忙吗?

CSS:

.cart-contents {
    float: right;
    display: inline-block;
}
a.login_button {
    float: right;
    padding: 7px;
    margin-right: 130px;
    margin-top: 30px;
    display: inline-block;
    color: #fd0e35;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    text-shadow: none;
    box-shadow: none;
    background-color: #fff;
    border-radius: 4px;
    border: 2px solid #fd0e35;
}

HTML:

<header id="masthead" class="site-header" role="banner">
    <div class="site-branding">

        <?php
        if ( is_front_page() && is_home() ) : ?>

            <img src="http://localhost:8888/devo-wordpress/wp-content/uploads/2016/04/DEVO2.png">

            <!-- if ( $cart_contents_count > 0 ) {
             if ($cart_contents_count == 0) {
                 $menu_item = '<li class="right"><a class="wcmenucart-contents" href="'. $shop_page_url .'" title="'. $start_shopping .'">';
             } else {
                 $menu_item = '<li class="right"><a class="wcmenucart-contents" href="'. $cart_url .'" title="'. $viewing_cart .'">';
             }

             $menu_item .= '<i class="fa fa-shopping-cart"></i> ';

             $menu_item .= $cart_contents.' - '. $cart_total;
             $menu_item .= '</a></li>';
            Uncomment the line below to hide nav menu cart item when there are no items in the cart
         = } -->

         <div id="basket"><a class"cart-contents"><?php echo WC()->cart->get_cart_total(); ?></a></div>


            <form id="login" action="login" method="post">
                <h1><img src="http://localhost:8888/devo-wordpress/wp-content/uploads/2016/04/DEVO2.png" class="login-logo" width="80" height="auto"></h1>
                <p class="status"></p>
                <label for="username">Email</label>
                <input id="username" type="text" name="username">
                <label for="password">Password</label>
                <input id="password" type="password" name="password">
                <a class="lost" href="<?php echo wp_lostpassword_url(); ?>">Forgotten your password?<br><br></a>
                <input class="submit_button" type="submit" value="Login" name="submit">
                <a class="close" href=""><span class="glyphicon glyphicon-remove"></span></a>
                <?php wp_nonce_field( 'ajax-login-nonce', 'security' ); ?>
            </form>

1 个答案:

答案 0 :(得分:2)

您遗漏了一个等号,宣布您的课程为购物车内容。

更改

<a class"cart-contents">

<a class="cart-contents">

那应该为你做。