css - Display two UL elements side by side, centered vertically and horizontally -


i've been struggling while , couldn't find right solution.

at bottom of page i've footer that's full width. inside want display list of messages , right next left icon, in case it's font awesome icon. message list needs centered both vertically , horizontally , icon has centered vertically.

i've tried doing using ul elements display: inline-block , text-align: center. messages displays correctly icon stuck in same place no matter size of container.

here's i've far:

<div class="error-message-container">   <ul class="error-message-bell">     <li aria-hidden="true" class="fa fa-bell-slash-o"></li>   </ul>   <ul class="error-message-list">     <li>lorem ipsum dolor sit amet, consectetur adipiscing elit</li>     <li>consectetur adipiscing elit</li>     <li>lorem ipsum dolor sit amet</li>     <li>lorem ipsum dolor sit amet, consectetur adipiscing elit</li>     <li>lorem</li>     <li>ipsum</li>   </ul> </div> 

and css:

.error-message-container {         border: 1px solid blue;         bottom: 0;         color: light-blue;         font-size: 12px;         left: 0;         position: fixed;         text-align: center;         width: 100%; }  .error-message-container .error-message-bell {   display: inline-block;   font-size: 20px;   height: 100%;   margin-top: 0;   padding: 0;   vertical-align: middle; }  .error-message-container .error-message-list {   display: inline-block;   font-weight: 500;   line-height: 1.2;   list-style-type: none;   margin-bottom: 11px;   margin-top: 11px;   padding-left: 8px; } 

https://jsfiddle.net/b1rw80jz/1/

does know how can accomplish this?

thanks

if need 1 icon, can use pseudo-elements::before bell

.error-message-container {         border: 1px solid blue;         bottom: 0;         color: light-blue;         font-size: 12px;         left: 0;         position: fixed;         text-align: center;         width: 100%; }  .error-message-container .error-message-list {   display: inline-block;   font-weight: 500;   line-height: 1.2;   list-style-type: none;   margin-bottom: 11px;   margin-top: 11px;   padding-left: 8px;   position: relative; /** provides reference ::before element **/ }  .error-message-list::before {   content: "\f1f6"; /** refers awesome font **/   font-family: fontawesome; /** refers awesome font **/   position: absolute; /** stick error-message-list **/   top: 50%; /** position icon 50% height of error-message-list **/   margin-top: -10px; /** minus half icon height truely vertically centered **/   left: -20px; /** push left out error-message-list **/ } 

https://jsfiddle.net/b1rw80jz/6/


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -