html - Better way to do this in CSS? -


i'm looking improve css , wondered if take quick on have far , explain improve.

demo: http://jsfiddle.net/42txfuru/

.author div {    width: 35%;    float: left  }  .author div.img {    width: 30%  }  .date {    text-align: right  }
<div class="author">      <div class="img">      <img src="http://placehold.it/70x70" />    </div>      <div>      <p><span class="vcard">barry rooney</span>      </p>    </div>      <div>      <p class="date"><span>today's date</span>      </p>    </div>    </div>

it's not practice omit ; @ end of last css definition in selector block. also, i'd recommend sort css definitions alphabetically.

then, keep html short necessary. see suggestions below. don't omit mandatory attributes on elements (in case alt on img).

.author {    font-size: 0;  /* fixes unwanted whitespace issues */   }  .author > * {    display: inline-block;    font-size: 14px; /* resetting font-size need */    vertical-align: middle;    width: 35%;  }  .author .img {    width: 30%;  }  .date {    text-align: right;  }
<div class="author">    <div class="img"><img src="http://placehold.it/70x70" alt="" /></div>    <span class="vcard">barry rooney</span>    <p class="date">today's date</p>  </div>


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

Delphi 7 and decode UTF-8 base64 -