채택완료

css 질문좀 드립니다.

2014-02-12 (수) 03:25:42 6,374

안녕하세여

css질문좀 드릴려고요 ㅠ

table 태그만 쓰다가 css를 배워보려고 공부중인데

보시는것처럼

가로 세로 100% (흰색으로..) 된

 화면 세로 정중앙 (세로 중앙)에 검정색 라인을 위치시키려 합니다..

<style>

#intro_wrap {width:100%;height:100%;background:#ffffff top center repeat-y;}
#intro_line {width:100%;height:220px;background:#000000 center middle repeat-x;vertice-align:middle}

</style>

<div id="intro_wrap">
 <div id="intro_line">
 </div>
</div>

잘안되는데 도움좀 주십시옹 ㅠㅠ

제목 없음-1.jpg
 

답변 3개

채택된 답변
+20 포인트
2014-02-12 (수) 07:42:30
Copy
<style>html {100%}body {100%;margin:0}#intro_wrap {width:100%;height:100%;background:#ffffff top center repeat-y;}
#intro_line {width:100%;height:220px;background:#000000 center middle repeat-x;vertice-align:middle;position:absolute;top:50;margin-top:-110px;}
</style>

<div id="intro_wrap"> <div id="intro_line"> </div></div>

html과 body에 height 100%를 잡지 않으면 div height 100%가 인시되지 않습니다.

line 경우에는 전체 height에서 50%만큼 top에서 포지션을 준 후, height/2 를 빼주시면 가운데 배치가 됩니다.

html5 로 작업하시면 

Copy
#intro_line {width:100%;height:220px;background:#000000 center middle repeat-x;vertice-align:middle;margin:auto 0;}

이 될지는 안해봤습니다만.. 되지않을까요 ㅋ

많은 도움이 되었습니다. 감사합니다.

2014-02-12 (수) 08:52:05
<div id="intro_wrap">dd
 <div id="intro_line">dd
 </div>
</div>
<style>
#intro_wrap {width:100%;height:100%; padding:50px 0; background:#ffffff top center repeat-y;}
#intro_line {border:1px solid #000; background:#000; text-align:center; }
</style>

이렇게 하시면 됩니다

단어를 정렬하려면 텍스트 - 위치 : (어디?)

이렇게 사용해야되고

float:left; 같은 css 코드는 위치:(어디?) 입니다.

답변을 작성하려면 로그인이 필요합니다.