컴

Vertical Navigation Bar

· 2017-06-08 (목) 19:00:10 · 2495 · 1

Vertical Navigation Bar

 

수직 탐색 모음을 만들려면 위 코드와 함께 목록 안의 <a> 요소의 스타일을 지정할 수 있습니다.

 

li a {

    display: block;

    width: 60px;

}

 

 

 

<!DOCTYPE html>

<html>

<head>

<style>

ul {

    list-style-type: none;

    margin: 0;

    padding: 0;

}

 

li a {

    display: block;

    width: 60px;

    background-color: #dddddd;

}

</style>

</head>

<body>

 

<ul>

  <li><a href="#home">Home</a></li>

  <li><a href="#news">News</a></li>

  <li><a href="#contact">Contact</a></li>

  <li><a href="#about">About</a></li>

</ul>

 

<p>A background color is added to the links to show the link area.</p>

<p>Notice that the whole link area is clickable, not just the text.</p>

 

</body>

</html>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A background color is added to the links to show the link area.

Notice that the whole link area is clickable, not just the text.

 

 

 

<!DOCTYPE html>

<html>

<head>

<style>

ul {

    list-style-type: none;

    margin: 0;

    padding: 0;

    width: 60px;

} 

 

li a {

    display: block;

    background-color: #dddddd;

}

</style>

</head>

<body>

 

<ul>

  <li><a href="#home">Home</a></li>

  <li><a href="#news">News</a></li>

  <li><a href="#contact">Contact</a></li>

  <li><a href="#about">About</a></li>

</ul>

 

<p>A background color is added to the links to show the link area.</p>

<p>Notice that the whole link area is clickable, not just the text.</p>

 

</body>

</html>

 

 

 

 

 

예제 설명 :

 

display: block; - 링크 요소를 블록 요소로 표시하면 텍스트뿐만 아니라 전체 링크 영역을 클릭 할 수있게되고 너비 (및 패딩, 여백, 높이 등)를 지정할 수 있습니다.

width: 60px;- 블록 요소는 기본적으로 사용 가능한 전체 폭을 차지합니다. 우리는 60 픽셀 너비를 지정하려고합니다.

<ul>의 너비를 설정하고 <a>의 너비를 제거 할 수 있습니다. 블록 요소로 표시 될 때 사용할 수있는 전체 너비를 차지하기 때문입니다. 이것은 앞의 예와 같은 결과를 낳습니다.

 

 

ul {

    list-style-type: none;

    margin: 0;

    padding: 0;

    width: 60px;

} 

 

li a {

    display: block;

}

 

 

A background color is added to the links to show the link area.

Notice that the whole link area is clickable, not just the text.

|

댓글 1개

잘보고 갑니다.
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리셔팁

1,282건

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

+
분류 제목 글쓴이 날짜 조회
CSS 17-07-18 조회 2,429
CSS 17-07-18 조회 2,501
CSS 17-06-13 조회 3,980
CSS 17-06-13 조회 3,336
CSS 17-06-13 조회 2,570
CSS 17-06-08 조회 2,056
CSS 17-06-08 조회 2,496
CSS 17-06-08 조회 1,986
CSS 17-06-06 조회 5,688
CSS 17-06-05 조회 3,640
CSS 17-06-05 조회 3,451
CSS 17-06-05 조회 2,528
HTML 17-06-02 조회 3,495
HTML 17-05-26 조회 3,935
CSS 17-05-05 조회 2,833
CSS 17-05-05 조회 2,315
CSS 17-05-05 조회 2,087
CSS 17-05-04 조회 3,075
CSS 17-05-04 조회 2,966
CSS 17-05-04 조회 3,469
CSS 17-04-10 조회 2,162
CSS 17-04-10 조회 1,848
CSS 17-04-10 조회 2,615
CSS 17-04-05 조회 2,263
CSS 17-04-05 조회 2,540
CSS 17-04-05 조회 2,536
CSS 17-04-04 조회 2,422
CSS 17-04-04 조회 2,586
CSS 17-04-04 조회 2,681
CSS 17-03-13 조회 3,251