html - How to align a div with an image horizontally within another div -
i having lot of trouble creating button in css. here how needs work:
the button needs have 2 sections, 1 call action text, , other right facing arrow. button needs dynamic, in sense used in content management system needs expand it's height.
the right arrow needs lined vertically text in middle, cannot seem achieve this.
here html:
<div class="assetbuttonwrap"> <div class="assetbuttontext"><a href="#" class="assetbuttontext">click here download whitepaper</a></div><div class="assetbuttonicon"><img src="images/arrow_right.png" width="8" height="12" alt="arrow"></div></div>
and here css
.assetbuttonwrap { border: none; padding: 12px 14px 12px 14px; margin-top:12px; height:100%; background-color: #dddddd; display:table; } .assetbuttonwrap:hover { background-color: #b6b6b6; cursor:pointer; } a.assetbuttontext:link { text-decoration:none; color: #666; } .assetbuttontext { color: #737373; display: inline-block; font-size: 16px; font-style: normal; font-weight: 700; line-height: 19px; max-width: 93%; text-align: left; text-decoration: none; vertical-align: middle; display: table-cell; } .assetbuttonicon { vertical-align: middle; display:inline-block; max-width:10%; }
i have attached image well, see how should look.
thank replies.
since you're using display: table
on parent, want direct children display: table-cell
if want them work , use vertical-align
property table would.
added display: table-cell
.assetbuttonicon
, gave element padding separate text icon.
.assetbuttonwrap { border: none; padding: 12px 14px 12px 14px; margin-top: 12px; height: 100%; background-color: #dddddd; display: table; } .assetbuttonwrap:hover { background-color: #b6b6b6; cursor: pointer; } a.assetbuttontext:link { text-decoration: none; color: #666; } .assetbuttontext { color: #737373; font-size: 16px; font-style: normal; font-weight: 700; line-height: 19px; max-width: 93%; text-align: left; text-decoration: none; vertical-align: middle; display: table-cell; } .assetbuttonicon { vertical-align: middle; display: table-cell; max-width: 10%; padding-left: .5em; }
<div class="assetbuttonwrap"> <div class="assetbuttontext"><a href="#" class="assetbuttontext">click here download whitepaper</a></div> <div class="assetbuttonicon"><img src="https://i.stack.imgur.com/wxy1a.png" width="8" height="12" alt="arrow"></div> </div>
Comments
Post a Comment