JAKARTAPROJECT
JAKARTA TIPJSP TIPJSP 질문&답변DATABASE TIPJAVASCRIPT TIPWEBHACKING TIP기타 TIP
자바스크립트 팁
자바스크립트 팁
자바스크립트 및 CSS 팁 게시판입니다
CSS centered layout
GoodBug http://www.jakartaproject.com
이미지 슬라이더 보기

CSS centered layout

Overview

Ever wanted to make centered (vertically, horizontally) webpage with hiding content for other (smaller) resolutions? Look at the demo page for an example.

First include the style sheet at the top of your code. Do it in <head> tag, then you can write your code.

 

Source code for index.html

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

    <head>
     <title>My project</title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link media="screen" type="text/css" rel="stylesheet" href="webtoolkit.clayout.css" />

     <style>
         body {
             margin: 0px;
             padding: 0px;
             font-family: verdana;
             font-size: 12px;
         }

            div#layout { /* exploder 5.5+ */
                width: expression((document.body.clientWidth > 790 ? document.body.clientWidth : 790) + "px");
                height: expression((document.body.clientHeight > 490 ? document.body.clientHeight : 490) + "px");
            }

            div#container,
            div#container div.container-top,
            div#container div.container-bottom {
                width: 790px;
            }

            div#container,
            div#container div.container-right,
            div#container div.container-left {
                height: 490px;
            }

            /* colors */
            div#container {
                background: #FFFFFF;
            }

            div#container div.container-top {
                background: #FF0000;
            }

            div#container div.container-right {
                background: #00FF00;
            }

            div#container div.container-bottom {
                background: #0000FF;
            }

            div#container div.container-left {
                background: #FFFF00;
            }

            div#container div.container-top-right {
                background: #00FFFF;
            }

            div#container div.container-bottom-right {
                background: #FF00FF;
            }

            div#container div.container-bottom-left {
                background: #C0C0C0;
            }

            div#container div.container-top-left {
                background: #000000;
            }
        </style>

    </head>

    <body>

        <div id="layout">
            <div id="container">
                <div class="container-top"></div>
                <div class="container-right"></div>
                <div class="container-bottom"></div>
                <div class="container-left"></div>

                <div class="container-top-right"></div>
                <div class="container-bottom-right"></div>
                <div class="container-bottom-left"></div>
                <div class="container-top-left"></div>

                Content goes here...
            </div>
        </div>

    </body>
</html>

 

Source code for webtoolkit.clayout.css

 

body, html {
    height: 100%;
}

    div#layout { /* exploder 5.5+ */
        position: absolute;
        left: 0px;
        top: 0px;
        overflow: hidden;
        text-align: center;
    }

    * > div#layout { /* normal browsers */
        min-width: 790px;
        min-height: 490px;
        width: 100%;
        height: 100%;
    }

        div#container {
            position: relative;
            top: 50%;
            margin-top: -245px;
            margin-left: auto;
            margin-right: auto;
            text-align: left;
        }

        div#container div.container-top {
            position: absolute;
            left: 0px;
            top: -1000px;
            height: 1000px;
        }

        div#container div.container-right {
            position: absolute;
            right: -1000px;
            top: 0px;
            width: 1000px;
        }

        div#container div.container-bottom {
            position: absolute;
            left: 0px;
            bottom: -1000px;
            height: 1000px;
        }

        div#container div.container-left {
            position: absolute;
            left: -1000px;
            top: 0px;
            width: 1000px;
        }

        div#container div.container-top-right {
            position: absolute;
            right: -1000px;
            top: -1000px;
            width: 1000px;
            height: 1000px;
        }

        div#container div.container-bottom-right {
            position: absolute;
            right: -1000px;
            bottom: -1000px;
            width: 1000px;
            height: 1000px;
        }

        div#container div.container-bottom-left {
            position: absolute;
            left: -1000px;
            bottom: -1000px;
            width: 1000px;
            height: 1000px;
        }

        div#container div.container-top-left {
            position: absolute;
            left: -1000px;
            top: -1000px;
            width: 1000px;
            height: 1000px;
        }

 

http://www.webtoolkit.info/css-centered-layout.html

 

 

2008-01-21 03:25:22
220.70.88.***

 

좋은생각 ^^

0점 (0명)
덧글 1개 | 태그 1개 | 관련글보기
태그입력
쉽표(,)구분으로 한번에 여러 태그를 입력할수 있습니다
CSS (2)
idhacker
(0) (0)

제가 요즘 관심있게 보는 부분인데..^^ ㄳ

211.238.161.*** 2008-01-21 03:25:22
이름 비밀번호
자바스크립트 팁
자바스크립트 및 CSS 팁 게시판입니다
! 번호 제목 글쓴이 일자 조회
220 img 이미지 부드럽게 줄이기 1 GoodBug 2009-12-18 8,152
219 rss xml 파싱하는 모듈 입니다. 1 고고싱 2009-11-27 7,603
218 트리 입니다 . 1 고고싱 2009-11-27 5,836
217 에러처리 1 kaiser 2009-05-11 6,052
216 웹페이지 복사 방지 해지 하는 법 kaiser 2009-05-03 11,636
215 javascript 한글 짜르기 1 1 kaiser 2008-08-14 7,945
214 rolling 롤링 스크립트 1 2 GoodBug 2008-07-11 10,092
213 alert 메시지를 print 처럼 사용하기 2 고고싱 2008-06-10 8,630
212 onload onload 펑션이 정의되어 있는 상황에서 onload에 추가하기 1 GoodBug 2008-04-11 8,409
211 javascript 자바스크립트 개발가이드 4 1 kaiser 2008-04-09 8,855
210 escape HTML escpae code 1 GoodBug 2008-04-02 6,462
209 optgroup SELECT 목록 그룹별로 묶기 1 1 GoodBug 2008-03-06 8,184
208 동적 테이블 테이블에 동적 TR 삽입 및 삭제 IE, FF 공용 1 GoodBug 2008-01-18 11,710
207 drag Javascript drag and drop 1 1 GoodBug 2008-01-16 8,128
206 sort Sortable HTML table 2 GoodBug 2008-01-16 7,363
205 scrollable table Scrollable HTML table 1 GoodBug 2008-01-16 7,045
CSS CSS centered layout 1 1 GoodBug 2008-01-16 6,649
203 utf8 Javascript UTF-8 1 GoodBug 2008-01-16 7,878
202 encode Javascript url decode, encode 2 GoodBug 2008-01-16 8,089
201 암호화 Javascript MD5 2 GoodBug 2008-01-15 7,327
copyright 2005-2018 by Unicorn