CSS를 통해서도 가능한가요?
시도 중입니다.
tr.classname {
border-spacing: 5em;
}
아무 소용이 없습니다. 제가 뭔가 잘못하고 있는 걸까요?
패딩 '요소' td 를 사용해야 합니다. 이 같은 일이 이 어떻게해야합니다 의심하게 된다. 물론 사용하여 동일한 결과를 얻을 수 있는 최고의 패딩 대신 패딩.
Css 는 코드 아래 있는 패딩, 즉 '만' 요소를 td 보다 큼 예중이 적용할 수 있는 요소는 클래스 '어린이' 직접 'tr 스파스언더'. 이렇게 하면 네스트된 테이블을 사용할 수 있습니다. (C, D 는 셀입니다 예제 코드에서.) # 39 m not 너무 확신하는 i&, 하위 브라우저 지원 (생각하노라 IE 6), 하지만 직접 선택기를 shouldn& # 39, t break the 코드 믿지아니하며 최신 브라우저.
<! - begin 스니핏: js 숨기십시오: 거짓값 콘솔: 진정한 바벨. > 거짓값 -;
/* Apply padding to td elements that are direct children of the tr elements with class spaceUnder. */
tr.spaceUnder>td {
padding-bottom: 1em;
}
<table>
<tbody>
<tr>
<td>A</td>
<td>B</td>
</tr>
<tr class="spaceUnder">
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>E</td>
<td>F</td>
</tr>
</tbody>
</table>
끝 - < 스니핏 >;!
이렇게 하면 어느 정도 렌더링합니다 다음과 같습니다.
+---+---+
| A | B |
+---+---+
| C | D |
| | |
+---+---+
| E | F |
+---+---+
Id 와 함께 앨범을 모든 데이터 테이블을 사용할 수 있습니다. 나는 제외한 trs, td
<table id="albums" cellspacing="0">
</table>
[Css.
table#albums
{
border-collapse:separate;
border-spacing:0 5px;
}
From Mozilla Developer Network:
>. Css 속성을 지정할 수 있는 국경 간격 사이의 거리를 국경 인접 세포 (대해서만 분판된 테두리 모델). 이 주소는 첼스파시영 속성에 대한 표상 HTML, 그러나 다른 두 번째 값은 수평 및 수직 spacing. 옵션으로 설정하는 데 사용할 수 있습니다
마지막 부분은 종종 있는 걸루. 예:
.your-table {
border-collapse: separate; /* allow spacing between cell borders */
border-spacing: 0 5px; /* NOTE: syntax is <horizontal value> <vertical value> */
내가 지금 하고 있는 것으로 알고, 별도의 특정 OP 증가되지는 행 간격. # 39 표 본문 '을 (를)' 는 설치, ve 추가되든지 i& 요소가 없는 이 시맨틱스를 판결을 받기도 했다. 그러나 I& # 39 m 의 모든 브라우저에서 지원하는 경우, 확실하지 않다. 내가 그것으로이라엘 있는 크롬.
아래 예제는 한 테이블에 존재하는 것처럼 보여야 할 수 있는 방법을 보여주는 캐비닛용입니다 행뿐만, css 의 전체 빨아준 느낀다. 또한 첫 번째 행을 제공했음 따라 간격이 더 '표 본문' 설정되었습니다. 언제든지 사용할 수 있습니다!
<! - begin 스니핏: js 숨기십시오: 거짓값 콘솔: 거짓값 바벨. > 거짓값 -;
.spacing-table {
font-family: 'Helvetica', 'Arial', sans-serif;
font-size: 15px;
border-collapse: separate;
table-layout: fixed;
width: 80%;
border-spacing: 0 5px; /* this is the ultimate fix */
}
.spacing-table th {
text-align: left;
padding: 5px 15px;
}
.spacing-table td {
border-width: 3px 0;
width: 50%;
border-color: darkred;
border-style: solid;
background-color: red;
color: white;
padding: 5px 15px;
}
.spacing-table td:first-child {
border-left-width: 3px;
border-radius: 5px 0 0 5px;
}
.spacing-table td:last-child {
border-right-width: 3px;
border-radius: 0 5px 5px 0;
}
.spacing-table thead {
display: table;
table-layout: fixed;
width: 100%;
}
.spacing-table tbody {
display: table;
table-layout: fixed;
width: 100%;
border-spacing: 0 10px;
}
<table class="spacing-table">
<thead>
<tr>
<th>Lead singer</th>
<th>Band</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bono</td>
<td>U2</td>
</tr>
</tbody>
<tbody>
<tr>
<td>Chris Martin</td>
<td>Coldplay</td>
</tr>
<tr>
<td>Mick Jagger</td>
<td>Rolling Stones</td>
</tr>
<tr>
<td>John Lennon</td>
<td>The Beatles</td>
</tr>
</tbody>
</table>
끝 - < 스니핏 >;!
'국경 축소 설정해야 합니다. '를 별도의 마련이다. 대부분의 브라우저 기본 스타일시트가 '국경 축소 시작. 축소, '개천 있는 국경 간격.
또한 국경 간격: '이 아니라' 에서 'TD 댁이라면 TR'.
종료기:
<html><head><style type="text/css">
#ex { border-collapse: separate; }
#ex td { border-spacing: 1em; }
</style></head><body>
<table id="ex"><tr><td>A</td><td>B</td></tr><tr><td>C</td><td>D</td></tr></table>
</body>
Take a look at the [국경 축소: 별도의] [1] 및 [국경 간격] [2] 재산이잖아 차지백 (기본)
이 두 가지 CSS 속성을 잘 지원 브라우저, 실제로 모든 알.
<! - begin 스니핏: js 숨기십시오: 거짓값 콘솔: 진정한 바벨. > 거짓값 -;
table {border-collapse: separate; border-spacing: 10px 20px;}
table,
table td,
table th {border: 1px solid black;}
<table>
<tr>
<td>Some text - 1</td>
<td>Some text - 1</td>
</tr>
<tr>
<td>Some text - 2</td>
<td>Some text - 2</td>
</tr>
<tr>
<td>Some text - 3</td>
<td>Some text - 3</td>
</tr>
</table>
끝 - < 스니핏 >;!
[1]: https://www.w3schools.com/cssref/tryit.asp = trycss_border-collapse 파일_이름? [2]: https://www.w3schools.com/cssref/tryit.asp = trycss_border-spacing 파일_이름?
내가 백업이었습니다 실현하기 위해 오토메이티드 해결책이 될 수 없는 반면 늙은 게시판 및 요청되었습니다, 내가 이 솔루션은 가져다줄래요 협력했습니다 필요한 모든 제안됩니다 솔루션뀉뀉뀉뀉 않았다.
내가 가진 2 개의 배경색에 셀입니다, 테이블, 다른 테두리가 색상. 오른쪽 위의 솔루션뀉뀉뀉뀉 분리하십시오 셀 수 있는 국경 도왔으매 스루가 만 상공 니어미스 떠 보일 것이다. 한 살 수 있는 솔루션을 재장착합니다 '표', '트릭' 를 함께 tr '와' td 및 해당 클래스: div id = " 테이블 ',', ', tr 약간만이라도 약간만이라도 table_replacer" tr_replacer",' 와 div class = ", td 약간만이라도 div class = " td_replacer" ',' (변경하십시오 div 태그를 닫는 것은 잘 알려져 있다).
내 문제 해법을 얻기 위해 css 는:
#table_replacer{display:table;}
.tr_replacer {border: 1px solid #123456;margin-bottom: 5px;}/*DO NOT USE display:table-row! It will destroy the border and the margin*/
.td_replacer{display:table-cell;}
따라서 누군가가 바란다.