html - Responsive elements with CSS background-image -


i want create football field showing player formation.

main problem having formation positions relative football field when background-size set contain. https://jsfiddle.net/ypvonhhy/1/

best solution i've come let height static: https://jsfiddle.net/a4y9dqqo/3/

 .outer {     width: 100%;     height: 900px;   }      section.field {      width: 100%;      min-height: 200px;      max-height: 320px;      background: url('http://s16.postimg.org/c5a4is9sl/field.png') no-repeat;      background-size: 100% 100%;      position: relative;;    }      .player {      font-size: 1.2rem;      position: absolute;  }
<div class="outer">      <section class="field">        <i class="player" style="left: 28%; top: 14%;">*</i>       <i class="player" style="left: 39%; top: 9%;">*</i>      <i class="player" style="left: 58%; top: 9%;">*</i>      <i class="player" style="left: 69%; top: 14%;">*</i>      </section>    </div>

this gets uglier when screen size has major differences (small/big).

would there better solutions setup?

the problem have set height of .outer 900px , background-size contain, means scaled untill fit.

you can declare background-size: 100% 100%; scale image fit horizontally , vertically (distorting image if necessary).

but perhaps not want, think may draw field using basic shapes , css-transforms (or svg if like) fit .outer , perhaps better scaled image.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -