简体   繁体   中英

Html Table Spacing Alignment

I'm brand new to html and I was wondering how I could I make a table to display something like this.

"name"_ _ _ _"date"

_ are suppose to be "blank spaces"

I always want "name" aligned on the left and "date" on the right, independent of what length they are.

I'm completely unfamiliar with html and I need this part for a very small portion of my code.

在样式表中,将text-align: left应用于第一列中的单元格,将text-align: right应用于第二列中的单元格。

如果它们在不同的列中,则第一个td做<td align='left'> ,第二个td做<td align='right'>

This looks like a typical two-column layout. Unordered lists are a good tool for this pattern:

<div class="twoCol">
  <ul>
    <li><label>Name</label>Date</li>
    ... more rows ...
  </ul>
</div>

CSS:

.twoCol ul, twoCol li {
    margin:0;
    padding:0;
    list-style:none;   
}

.twoCol ul {
    width:200px;   
}   

.twoCol label {
     float:left;
     display:block;  
     width:120px;
     text-align:left;

}

.twoCol li {
     clear:both;
     text-align: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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM