웹프로그래밍

Global It Leader!!


CSS


 
 

테이블 1행과 1열 고정하고 싶을때

페이지 정보

작성자 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 951회 작성일 22-09-01 13:47

본문

첨부소스는 1행과 1열을 고정하는 소스이다.

마지막 행도 고정하고 </tbody> 아래 다음과 같이 소스를 추가하고

<tfoot>
<tr>
<th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th>
</tr>
</tfoot>


아래 스타일을 지정하면 마지막 행도 고정이 된다.

table#jb-table thead { position: sticky; top: 0; z-index: 1; }
table#jb-table th:first-child,
table#jb-table td:first-child { position: sticky; left: 0; }
table#jb-table tfoot { position: sticky; bottom: 0; }

제1열과 제2열을 고정하고 싶다면 다음과 같이 한다. 제2열의 left 값은 제1열의 크기에 맞게 적절히 정한다.

table#jb-table th:first-child,
table#jb-table td:first-child { position: sticky; left: 0; }
table#jb-table th:nth-child(2),
table#jb-table td:nth-child(2) { position: sticky; left: 183px; }

첨부파일

댓글목록

등록된 댓글이 없습니다.

전체 72
게시물 검색
CSS 목록
번호 제목 글쓴이 조회 날짜
12 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2428 12-19
11 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2185 06-07
10 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1892 08-23
9 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1789 04-24
8 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1732 09-20
7 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1305 03-18
6 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1274 03-25
5 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1271 03-26
4 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 1266 03-28
열람중 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 952 09-01
2 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 628 04-09
1 no_profile 운영자 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 416 07-31