레이아웃 - CSS 문제
Nov 07, 2024 am 05:33 AM이 게시물의 모든 코드는 Github 저장소에서 확인하실 수 있습니다.
영상은 여기에서 확인하실 수 있습니다:
- 고정 탐색 - 레이아웃 - CodeSandbox
- 2열 - 레이아웃 - CodeSandbox
- 3열 - 레이아웃 - CodeSandbox
- 성배 - 레이아웃 - CodeSandbox
CSS를 통한 공통 레이아웃
고정 탐색 레이아웃
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Fixed Navigation</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <nav>This is a navbar</nav> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> <h1>Test</h1> </body> </html>
로그인 후 복사
nav { position: fixed; top: 0; z-index: 1000; width: 100%; }
로그인 후 복사
2열 레이아웃
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Two Columns Layout</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <!-- <div> <pre class="brush:php;toolbar:false">.float-container .left { width: 200px; float: left; background-color: tomato; } .float-container .right { margin-left: 200px; background-color: aqua; } .absolute-container { position: relative; } .absolute-container .left { width: 200px; position: absolute; top: 0; left: 0; background-color: tomato; } .absolute-container .right { margin-left: 200px; background-color: aqua; } .bfc-container .left { width: 200px; float: left; background-color: tomato; } .bfc-container .right { overflow: hidden; background-color: aqua; } .flex-container { display: flex; } .flex-container .left { width: 200px; background-color: tomato; } .flex-container .right { flex: 1; background-color: aqua; } .grid-container { display: grid; grid-template-columns: 200px 1fr; } .grid-container .left { background-color: tomato; } .grid-container .right { background-color: aqua; } .table-container { display: table; } .table-container .left { display: table-cell; background-color: tomato; } .table-container .right { display: table-cell; background-color: aqua; }
로그인 후 복사
3열 레이아웃
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Three Columns Layout</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <div> <pre class="brush:php;toolbar:false">.flex-container { display: flex; } .flex-container .left { width: 200px; background-color: tomato; } .flex-container .middle { flex: 1; background-color: blanchedalmond; } .flex-container .right { width: 200px; background-color: aqua; } .grid-container { display: grid; grid-template-columns: 200px 1fr 200px; } .grid-container .left { background-color: tomato; } .grid-container .middle { background-color: blanchedalmond; } .grid-container .right { background-color: aqua; } .absolute-container { position: relative; } .absolute-container .left, .absolute-container .right { position: absolute; width: 200px; top: 0; } .absolute-container .left { left: 0; background-color: tomato; } .absolute-container .right { right: 0; background-color: aqua; } .absolute-container .middle { margin-left: 200px; margin-right: 200px; background-color: blanchedalmond; } .float-container .left { width: 200px; float: left; background-color: tomato; } .float-container .right { width: 200px; float: right; background-color: aqua; } .float-container .middle { margin-left: 200px; margin-right: 200px; background-color: blanchedalmond; }
로그인 후 복사
성배
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Holy Grail</title> <link rel="stylesheet" href="styles.css" /> </head> <body> <header>Header</header> <div> <pre class="brush:php;toolbar:false">body { min-height: 100vh; } #root { display: flex; flex-direction: column; min-height: 100vh; } header, nav, main, aside, footer { text-align: center; padding: 12px; } header { height: 60px; background-color: tomato; } .columns { display: flex; flex-grow: 1; } nav { flex-shrink: 0; width: 100px; background-color: coral; } main { flex-grow: 1; background-color: moccasin; } aside { flex-shrink: 0; width: 100px; background-color: sandybrown; } footer { height: 100px; background-color: slategray; }
로그인 후 복사
참조
- 성배(웹 디자인) - Wikipedia.org
- 성배 레이아웃 - Web.dev
위 내용은 레이아웃 - CSS 문제의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

인기 기사
스플릿 소설을이기는 데 얼마나 걸립니까?
3 몇 주 전
By DDD
Repo : 팀원을 부활시키는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
헬로 키티 아일랜드 어드벤처 : 거대한 씨앗을 얻는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
2 포인트 박물관 : 모든 전시회 및 찾을 수있는 곳
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌

인기 기사
스플릿 소설을이기는 데 얼마나 걸립니까?
3 몇 주 전
By DDD
Repo : 팀원을 부활시키는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
헬로 키티 아일랜드 어드벤처 : 거대한 씨앗을 얻는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
2 포인트 박물관 : 모든 전시회 및 찾을 수있는 곳
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제
Gmail 이메일의 로그인 입구는 어디에 있나요?
7126
9


자바 튜토리얼
1534
14


라라벨 튜토리얼
1256
25


PHP 튜토리얼
1205
29


Cakephp 튜토리얼
1153
46



Smart Forms 프레임 워크로 JavaScript 연락처 양식 작성

5 개의 최고의 PHP 양식 빌더 (및 3 개의 무료 스크립트) 비교

Codecanyon 2025에 대한 최고의 CSS 애니메이션 및 효과 (무료)
