The float on the left and right inside the Li Tag with a separate anchor each

I have a container where I want to display some items on the left and want to put the trash can icon on the right side. I tried this but didn't work, what's wrong here?

Both text and images have separate links.

Fiddle

HTML

<div class="showcase">
    <ul>
        <li class="item">
            <h1><a href="#">Item 1 + Star 1
                    <small>
                        <del>Rs. 6000</del>
                        <span> Rs. 3000</span>
                    </small>
                </a>
            </h1>
            <span class="pic"><a href="#"><img src="https://cdn0.iconfinder.com/data/icons/iicon/512/buy-Cart-48.png" alt=""></a></span>
        </li>
        <li class="item">
            <h1><a href="#">Item 2 + Star One
                    <small>
                        <del>Rs. 6000</del>
                        <span> Rs. 3000</span>
                    </small>
                </a>
            </h1>
            <span class="pic"><a href="#"><img src="https://cdn0.iconfinder.com/data/icons/iicon/512/buy-Cart-48.png" alt=""></a></span>
        </li>
    </ul>
</div>

CSS

.showcase ul {list-style-type: none;padding: 0;margin: 0 5px;}
.showcase li.item {border-bottom:1px solid #000;}
.showcase li.item a {display: block;color:#000;clear:both;}
.showcase li.item span.pic img {float: right;width:50px;height:50px;float:right;}

.showcase li.item h1 {text-transform: uppercase;font-family: 'fauna_oneregular' serif;white-space: normal;font-size: 0.8em;}
.showcase li.item h1 a {color:#000 !important;text-decoration: none}
.showcase li.item h1 small {color:#a51c10;display: block;}
.showcase li.item h1 small span {color:#79a510;}
+4
source share
4 answers

Fiddle

First, you need to add clarity after your floating elements have resumed the flow of documents:

<div style='clear:both;'></div>

Then you need to move float:right;from .showcase li.item span.pic imgto:

span.pic{
    float:right;
}

, , clearfix, inline clear .

FIDDLE clearfix.

+2

1) <h1> <a> , ,

CSS

.showcase li.item a {display:inline-block;color:#000;clear:both;}
.showcase li.item h1 {display:inline-block;}

2) float:right img span, , li, float span

CSS

.showcase li.item span.pic{float:right;}
+1

href display:block

display:inline-block pic, h1 href link

http://jsfiddle.net/raunakkathuria/MTHuP/3/

0

html css, span .

<li class="item">
<h1><span class="pic"><a href="#"><img src="https://cdn0.iconfinder.com/data/icons/iicon/512/buy-Cart-48.png" alt=""></a></span>
  <a href="#">Aaryogyam 1.7A One + One
    <small>
    <del>Rs. 6000</del>
    <span> Rs. 3000</span>
    </small></a>
 </h1>

http://jsfiddle.net/MTHuP/4/

0
source

All Articles