html - can i change the width of image, that put by content in css -
i making round tabs form steps, have change image when link active. it's changing size of changed image different. should this?
css:
li.active span.round-tabs.two { border: 2px solid #ddd; color: #febe29; background: blue !important; content: url('../images/round-tap-icons/round-tab-icon-3.png'); }
<ul class="nav nav-tabs" id="mytab"> <div class="liner"></div> <li class="active"> <a href="#home" title="welcome"> <span class="round-tabs one" onclick="showtabimg()"> <img src="images/round-tap-icons/round-tab-icon-1.png" /> <img src="images/round-tap-icons/round-tab-icon-1-white.png" style="display:none" /> </span> </a> <h3>order</h3> </li> <li> <a href="#wallet" data-toggle="tab" title="wallet"> <span class="round-tabs two"> <img src="images/round-tap-icons/round-tab-icon-2.png" /> </span> </a> <h3>didgital wallet</h3> </li> <li> <a href="#payment" data-toggle="tab" title="payment"> <span class="round-tabs three"> <img src="images/round-tap-icons/round-tab-icon-3.png" /> </span> </a> <h3>payment</h3> </li> <li> <a href="#confirmation" data-toggle="tab" title="blah blah"> <span class="round-tabs four"> <img src="images/round-tap-icons/round-tab-icon-4.png" /> </span> </a> <h3>confirmation</h3> </li> </ul>
these both image link active or link unactive.
when dealing multiple images of different sizes in defined size container, got multiple options:
the first, naïve 1 , best resize them. because if manually, you'll able want, , when reducing size of image reduce size of file users have load. better page speeds.
the second use images background of container. gives option play css property background-size
resize picture see fit according results trying achieve. you'll want use cover
or contain
values. read more here.
the third possibility play images' css width, height , min-/max- values. though able define either heights or widths if want keep ratio contraints.
finally, unlike comments state, think javascript useless on cases.
edit: when using background-size: cover/contain
take of container's size. trick here either have smaller container inside. or better yet, since seems container contains image, can use background-clip:padding-box
, use padding restrain size of background image. read more here
Comments
Post a Comment