Created
February 23, 2021 12:50
-
-
Save jdzcn/016d02fe2861a8646d93bd5e51e9e226 to your computer and use it in GitHub Desktop.
css:columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 创建两列 */ | |
/* Left column */ | |
section { | |
float: left; | |
height: 500px; | |
width: 75%; | |
background-color: #f1f1f1; | |
border: 1px; | |
padding: 5px; | |
} | |
/* 右侧栏 */ | |
aside { | |
float: left; | |
width: 25%; | |
padding: 5px; | |
padding-left: 20px; | |
} | |
/* 响应式布局 - 屏幕尺寸小于 800px 时,两列布局改为上下布局 */ | |
@media screen and (max-width: 1200px) { | |
section, aside { | |
width: 100%; | |
padding: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment