CSS:父元素float适用于<a> tag content too

时间:2017-07-25 20:02:56

标签: html css

this is HTML code:

<div class="pull-left small-text">
    <?php
        if($page - 1 > 0): ?>
            <a href="<?php echo $page_link.'&p='.($page -1); ?>" class="btn btn-white"><i class="fa fa-chevron-right"></i></a>
    <?php
        endif; ?>
    <span><?php echo $page; ?> from <?php echo $pages; ?></span>
    <?php
        if($page < $pages) : ?>
            <a href="<?php echo $page_link.'&p='.($page +1); ?>" class="btn btn-white"><i class="fa fa-chevron-left"></i></a>
    <?php
        endif; ?>
</div>

css:

.btn {
    border:none;
    background: none;
    color: #fff;
    padding: 10px 30px;
    text-align: center;
    font-size: 0.9em;
    border-radius: 4px;
}
.pull-left{
    float:left;
}

problem: when I add pull-left class to parent element , <a> tag icon goes left, It's what's happening:

result

注意:pull-left = float:left;

1 个答案:

答案 0 :(得分:-1)

display:inline-block添加到btn