I have the text followed by (:)
the colon are not aligned. Can any one help me in aligining them.
<div>
<h4> Candidate Name :</h4>
<h4> Branch :</h4>
<h4> Position:</h4>
<h4> Reference Name :</h4>
<h4> Reference Phone # :</h4>
<h4> Reference Company :</h4>
<h4> Reference Job Title:</h4>
<h4> Relationship to Employee:</h4>
</div>
Current Output:
Requested Output:
This looks like tabular data so in this case you can use CSS table layout
div { display: table; } h4 { display: table-row; } h4 span { display: table-cell; }
<div> <h4> Candidate Name <span>: Random data</span></h4> <h4> Branch <span>: Lorem</span></h4> <h4> Position <span>: Lorem ipsum dolor</span></h4> <h4> Reference Name <span>: Random data</span></h4> <h4> Reference Phone # <span>: Random data</span></h4> <h4> Reference Company <span>: Random data</span></h4> <h4> Reference Job Title <span>: Random data</span></h4> <h4> Relationship to Employee <span>: Random data</span></h4> </div>
Or you can change your HTML and just use Tables
<table> <tr> <td>Candidate Name </td> <td>: Random data</td></tr> <tr> <td>Branch</td> <td>: Lorem</td></tr> <tr> <td>Position </td><td>: LOrem ipsum dolor</td></tr> <tr> <td>Reference Name </td> <td>: Random data</td></tr> <tr> <td>Reference Phone #</td> <td>: Random data</td></tr> <tr> <td>Reference Company</td> <td>: Random data</td></tr> <tr> <td>Reference Job Title</td> <td>: Random data</td></tr> <tr> <td>Relationship to Employee </td><td>: Random data</td></tr> </table>
div { display: inline-block; } #values h4:before { content: ': '; }
<div id="labels"> <h4>Candidate Name</h4> <h4>Date Completed</h4> <h4>Branch</h4> <h4>Position</h4> <h4>Reference Name</h4> <h4>Reference Phone #</h4> <h4>Reference Company</h4> <h4>Reference Title</h4> <h4>Relationship to Employee</h4> </div> <div id="values"> <h4>Name</h4> <h4>11/11/1111</h4> <h4>Mississigua</h4> <h4>Salesforce Developer</h4> <h4>John Smith</h4> <h4>(416) 563-8888</h4> <h4>Ocean Trailer</h4> <h4>Service Manager</h4> <h4>Direct Supervisor</h4> </div>
<div style="width: 200px">
<h4> Candidate Name :</h4>
<h4> Branch :</h4>
<h4> Position:</h4>
<h4> Reference Name :</h4>
<h4> Reference Phone # :</h4>
<h4> Reference Company :</h4>
<h4> Reference Job Title:</h4>
<h4> Relationship to Employee:</h4>
</div>
h4 {
float: right;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.