html - Centered text being pushed over CSS -


i'm going make question applicable viewers.

question: how can keep centered div centered relative header, , have div @ same time side , not pushing centered div over?

whenever add header, centered title being pushed over. don't understand why happening since css supposed relative parent.

css code:

#logout_link {   margin-right:0;   text-align:right;   float:right; }  #centered {    text-align:center; } 

php/html code:

 <div id='header'>     <div id='centered'>centered title</div>     <div id='logout_link'> logout </div>  </div> 

try one.

<style> #header{   width:100%;   overflow:hidden; } #logout_link {   margin-right:0;   text-align:right;   float:right;   width:20%; }  #centered {    text-align:center;   width:80%;   float:left;  } </style>  <div id='header'>     <div id='centered'>centered title</div>     <div id='logout_link'> logout </div>  </div> 

you can change width of div on requirements.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -