Oracle Content Management는 모바일 장치에 표시될 때 행 데이터가 누적되도록 하는 단락 구성요소 내 반응형 테이블의 CSS 예를 제공합니다.
반응형 테이블은 화면 크기에 따라 효과적으로 콘텐츠가 표시되도록 테이블을 조정합니다. 예를 들어, 5열 테이블은 웹 페이지에서 가로로 잘 표시될 수 있지만, 전화에서 표시될 때는 데이터가 누적형으로 제공되는 것이 효과적일 수 있습니다. 반응형 테이블이 올바르게 작동하려면 머리글 행이 필요합니다.
다음과 같이 생성된 HTML에서는 값이 열 머리글 텍스트와 일치하는 각 테이블 셀에 추가된 data-label 속성이 있습니다.
<thead> <tr> <th scope="col">ACCOUNT</th> <th scope="col">DUE DATE</th> <th scope="col">AMOUNT</th> <th scope="col">MINIMUM</th> <th scope="col">PERIOD</th> </tr> </thead> <tbody> <tr> <td data-label="ACCOUNT">Visa</td> <td data-label="DUE DATE">04/16/2020</td> <td data-label="AMOUNT">$3,090</td> <td data-label="PERIOD">03/09/2020 - 04/08/2020</td> </tr>
속성이 각 셀에 있을 경우 아래 CSS 규칙을 적용할 때 TD는 서로의 위에 누적됩니다.
.scs-paragraph:not(.scs-paragraph-edit) table td { border-bottom: 1px solid #ddd; display: block; text-align: right; } .scs-paragraph:not(.scs-paragraph-edit) table td::before { content: attr(data-label); float: left; font-weight: bold; }
아래 매체 규칙은 화면 크기를 질의하며 화면 크기가 767픽셀 미만인 경우에만 적용됩니다.
@media screen and (max-width: 767px) {
CSS를 사용하여 삽입된 테이블이 반응형 테이블이 되도록 허용하는 코드 예는 제공된 StarterTheme의 기본 design.css에 있습니다. StarterTheme에서 사이트를 구축하는 경우 단락 슬롯에 삽입되는 테이블이 기본적으로 반응형 테이블로 설정됩니다. 테이블을 삽입하려면 다음과 같이 하십시오.
완료되면 보기 모드로 다시 토글하고 화면 너비가 767픽셀 미만인 보기 옵션을 선택하여 결과 미리보기를 수행합니다. 편집 모드에서는 테이블의 반응형 작동이 지원되지 않으므로 보기 모드여야 합니다.
다른 테마에서 사이트를 구축할 때 반응형 테이블을 사용하려면 StarterTheme design.css의 코드를 사용하려는 테마의 design.css 파일에 복사해야 합니다.
/** * An example CSS of how to render a table responsively. * It enables stacking of row data on mobile devices. * Only do this for view mode (not for edit mode). * * On each cell rendered, it adds a user-defined attribute * 'data-label' with value matching the column header text. */ @media screen and (max-width: 767px) { .scs-paragraph:not(.scs-paragraph-edit) table { border: 0; } .scs-paragraph:not(.scs-paragraph-edit) table caption { font-size: 1.3em; } .scs-paragraph:not(.scs-paragraph-edit) table thead { border: none; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .scs-paragraph:not(.scs-paragraph-edit) table tr { border-bottom: 3px solid #ddd; display: block; margin-bottom: .625em; } .scs-paragraph:not(.scs-paragraph-edit) table td { border-bottom: 1px solid #ddd; display: block; text-align: right; } .scs-paragraph:not(.scs-paragraph-edit) table td::before { content: attr(data-label); float: left; font-weight: bold; } .scs-paragraph:not(.scs-paragraph-edit) table td:last-child { border-bottom: 0; } }