html - Icon won't center align in button -


i have button set this:

i cannot life of me icon sit in middle of button.

this css:

.buttonclass {   width: 30px;   height: 30px;   border-radius: 20px;   background-color: #1dbe60 }   .iconclass {   width: 20px;   height: 20px;   margin: 7.5px; } 

the caveat need margin on iconclass.

here's plunk...

http://plnkr.co/edit/6flyqlpfmddf7awenbtp?p=preview

setting image background-image best bet.

if can't create css rule .iconclass nested in .buttonclass since said cannot remove margin .iconclass directly.

something this:

.buttonclass .iconclass{   margin:0;   position:absolute;   top:50%;   left:50%;   transform:translate(-50%, -50%); } 

updated plunker.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -