0
나는이 같은 테이블을 생성 할
를 사용하지만, DIV 대신 테이블사업부
<style type="text/css">
body{ font-family:"Segoe UI", "Tahoma" }
td {
padding:0px 5px 10px 5px;
}
.username {
white-space:nowrap;
vertical-align:top;
text-align:right;
width:auto;
color:DodgerBlue;
}
</style>
<table width="500px" >
<tr>
<td class="username">copperfield</td>
<td>How to create table by using div </td>
<td style="vertical-align:top">time </td>
</tr>
<tr>
<td class="username">copperfield</td>
<td>
How to create table by using div How to create table by sing div How to create table by to create table by using div <img src="images/thinking.gif"> </br>
</td>
<td style="vertical-align:top"> 8:00 </td>
</tr>
<tr>
<td class="username"> </td>
<td>
How to create table by using div</br>
</td>
<td style="vertical-align:top"> 8:00 </td>
</tr>
<tr>
<td class="username"> </td>
<td>
How to create table by using div</br>
</td>
<td style="vertical-align:top"> 8:00 </td>
</tr>
<tr>
<td class="username">michael</td> <td><img src="images/thinking.gif"> Gi ku </td>
<td style="vertical-align:top"> 8:00 </td>
</tr>
</table>
나는 다음과 같은 코드를 시도하지만
<style type="text/css">
body{
font-family:Segoe UI;
}
.all{
float:left;
display:block;
}
.chat{
width:700px;
float:left;
display:table-cell;
}
.us{
color:blue;
text-align:right;
float:left;
margin-right:10px;
}
.ct{
white-space:normal;
float:left;
margin-right:10px;
}
.t{
float:left;
width:auto
}
</style>
<div class="all">
<div class="chat">
<div class="us"> userna3 46346346me </div>
<div class="ct"> content </div >
<div class="t"> time </div>
</div>
<div class="chat">
<div class="us"> copperfield </div>
<div class="ct"> How to create table by using div How to create table by sing div How to create table by to create table by using div</div>
<div class="t"> 8:00 </div>
</div>
<div class="chat">
<div class="us"> copperfield </div>
<div class="ct"> How to create table by using div Ho </div>
<div class="t"> 8:00 </div>
</div>
</div>
인기있는 믿음 표와 달리 사용하면 악조건이 아닙니다. 테이블 물건 .... – Josh
css float 속성 (http://www.w3schools.com/cssref/pr_class_float.asp)을 검색해야합니다. –
'
답변
이 성공하지를 사용하여 테이블을 만드는 방법 당신이 원하는 것 같습니다 : http://jsfiddle.net/ttunW/. 핵심은
.chat
를 들어,.all
,display:table-row;
에 대한display:table;
를 사용하던 모든div
들에float:left
속성을 제거하기 및.chat
내div
s의display:table-cell;
을 할당.출처
2011-08-01 17:28:22
호환성 모드에서 IE가 제대로 작동하지 않습니다. – Gabe
아니요. IE에서 작동해야하는 경우,이 상황에서 의미 상으로 정확하기 때문에 '
제대로 작동하지 않습니다. 페이지에 고정 너비가 700px이고 첫 번째 열 이름 및 열 시간에 자동 크기가 있어야하고 줄 바꿈을하지 않아야합니다. – KevinBui
플로트에 떠있는 뭔가를 가질 수 없습니다. 그냥 못생긴 브라우저에서 작동하지 않습니다 기침 IE 기침.
그래서 다음과 같이 당신의 CSS에서 당신의 모든 클래스를 변경 :그런 다음 수업에서 다른 모든 수레를 빼앗아. 우리, ct 및 t는 각 채팅 div의 내부에 너비를 설정합니다. 또한 div의 div 태그를 p 태그로 변경하십시오.
출처
2011-08-01 17:30:55 Luke
열 이름의 너비가 텍스트 사용자 이름과 일치하기 때문에 수정 크기로 너비를 설정해야한다고 생각하지 않습니다. – KevinBui
관련 문제