CSS分页不格式化

时间:2014-03-31 14:11:39

标签: php css pagination

我正在尝试格式化我的分页的颜色和布局,但似乎没有任何工作。以下是尝试过的代码片段。我希望有一个明显的原因,我不能格式化它?

php分页代码:

<?php
    //Pagination Starts
        echo "<div class='pagination'>";
        $prev = $start - $per_page;
        $next = $start + $per_page;                     
        $last = $max_pages - 1;
        if($max_pages > 1){   
        //previous button
            if (!($start<=0)) 
                echo "<a href='index.php?os=$os=Search+source+code&start=$prev' class='page'>Prev |</a> ";             
                //pages 
            $i = 0;   
            for ($counter = 1; $counter <= $max_pages; $counter++){
                if($i == $start){
                echo " <a href='index.php?os=$os=Search+source+code&start=$i' class='page active'><b> $counter |</b></a> ";
                }
                else {
                    echo " <a href='index.php?os=$os=Search+source+code&start=$i' class='page'> $counter |</a> ";
                }  
            $i = $i + $per_page;                 
            }
        }      
    //next button
    if (!($start >=$foundnumapps-$per_page))
        echo " <a href='index.php?os=$os=Search+source+code&start=$next' class='page'> Next</a> ";    
    }   
    echo "</div></div>"
    ?>

CSS:

 .pagination {
        background: #f2f2f2;
        padding: 20px;
        margin-bottom: 20px;
    }

    .page {
        display: inline-block;
        padding: 0px 9px;
        margin-right: 4px;
        border-radius: 3px;
        border: solid 1px #c0c0c0;
        background: #e9e9e9;
        box-shadow: inset 0px 1px 0px rgba(255,255,255, .8), 0px 1px 3px rgba(0,0,0, .1);
        font-size: .875em;
        font-weight: bold;
        text-decoration: none;
        color: #717171;
        text-shadow: 0px 1px 0px rgba(255,255,255, 1);
    }

    .page:hover {
        background: #fefefe;
        background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#FEFEFE), to(#f0f0f0));
        background: -moz-linear-gradient(0% 0% 270deg,#FEFEFE, #f0f0f0);
    }

    .page.active {
    border: none;
    background: #616161;
    box-shadow: inset 0px 0px 8px rgba(0,0,0, .5), 0px 1px 0px rgba(255,255,255, .8);
    color: #f0f0f0;
    text-shadow: 0px 0px 3px rgba(0,0,0, .5);
}

1 个答案:

答案 0 :(得分:-1)

在活动项目的css定义中,仅使用 .active 而不是 .page.active