div 블록 레이아웃 가운데 정렬하기
html)
width를 지정하고 margin : 0 auto를 준다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, height=device-height, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0"> <title>Insert title here</title> <style> div { margin: 0 auto; background : #FFD8D8; width : 50%; height : 300px; } </style> </head> <body> <div></div> </body> </html> | cs |
결과
'IT > - 프로그래밍' 카테고리의 다른 글
HTML5/CSS3 border-collapse: collapse : cell 사이의 공백을 제거한다 (0) | 2017.06.13 |
---|---|
HTML5/CSS3 table-layout: fixed : table요소의 cell의 너비를 동일하게 고정 (0) | 2017.06.12 |
HTML5/CSS3 div태그 좌우 반으로 나누기 (0) | 2017.06.10 |
HTML5/CSS3 background-origin: content-box, background-origin: border-box (0) | 2017.06.09 |
HTML5/CSS3 background-clip: content-box 배경을 content영역에만 보이도록 한다 (0) | 2017.06.08 |