컴

css position: fixed;

· 2017-04-04 (화) 12:43:33 · 2679

css position: fixed;

 

position: fixed;가 있는 요소 는 뷰포트를 기준으로 배치됩니다. 

즉, 페이지가 스크롤 되어도 항상 같은 위치에 유지됩니다. 

위쪽, 오른쪽, 아래쪽 및 왼쪽 속성은 요소의 위치를 ​​지정하는 데 사용됩니다.

 

고정 요소는 일반적으로 위치한 페이지에 간격을 두지 않습니다.

 

페이지의 오른쪽 아래에 고정 된 요소가 있음을 확인하십시오. 

다음은 사용 된 CSS입니다.

 

예

div.fixed {

    position: fixed;

    bottom: 0;

    right: 0;

    width: 300px;

    border: 3px solid #73AD21;

}

 

 

<!DOCTYPE html>

<html>

<head>

<style>

div.fixed {

    position: fixed;

    bottom: 0;

    right: 0;

    width: 300px;

    border: 3px solid #73AD21;

}

</style>

</head>

<body>

 

<h2>position: fixed;</h2>

 

<p>An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled:</p>

 

<div class="fixed">

This div element has position: fixed;

</div>

 

</body>

</html>


55bd5cbe823cf1d4f428efe8d8cbba0a_1491277407_5665.png

|
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리셔팁

1,282건

퍼블리싱과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
CSS 17-07-18 조회 2,427
CSS 17-07-18 조회 2,500
CSS 17-06-13 조회 3,978
CSS 17-06-13 조회 3,335
CSS 17-06-13 조회 2,568
CSS 17-06-08 조회 2,054
CSS 17-06-08 조회 2,492
CSS 17-06-08 조회 1,984
CSS 17-06-06 조회 5,685
CSS 17-06-05 조회 3,637
CSS 17-06-05 조회 3,449
CSS 17-06-05 조회 2,526
HTML 17-06-02 조회 3,494
HTML 17-05-26 조회 3,934
CSS 17-05-05 조회 2,830
CSS 17-05-05 조회 2,312
CSS 17-05-05 조회 2,085
CSS 17-05-04 조회 3,073
CSS 17-05-04 조회 2,964
CSS 17-05-04 조회 3,467
CSS 17-04-10 조회 2,160
CSS 17-04-10 조회 1,846
CSS 17-04-10 조회 2,613
CSS 17-04-05 조회 2,261
CSS 17-04-05 조회 2,539
CSS 17-04-05 조회 2,534
CSS 17-04-04 조회 2,420
CSS 17-04-04 조회 2,585
CSS 17-04-04 조회 2,680
CSS 17-03-13 조회 3,249