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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -