[html/css]링크 버튼 만들기,vertical align

2024. 8. 3. 21:16·HTML|CSS
반응형

20240801수업

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .linkBtn{
      background-color: #f44336;
      color: white; /* =)rgb(255,255,255), hsl(0,0,255), #ffffff */
      padding : 15px 25px;
      /* 가운데로 밀기위해서 아래위로 padding */
      /*기존:height: 52px;
      vertical-align: middle;*/
      
      display: inline-block;
      text-decoration: none;
      ;
    }
    
   .linkBtn:hover {
    background-color: red;
   }
   .linkBtn2{

      background-color: #f44336;
      color: white; 
      line-height: 52px;
      /* 가운데 정렬을 위함 */
      padding-left: 25px;
      padding-right: 25px;
      display: inline-block;
      text-decoration: none;
      ;
    }
  </style>
</head>
<body>
  <h2>Link Button</h2>
  <a href="https://sports.news.nate.com/view/20240801n05190?mid=s9810"> '눈떠보니 월드스타' 김예지, 조회수 4000만회 세계적 폭발</a><br><br>
  <a href="https://sports.news.nate.com/view/20240801n05190?mid=s9810" class="linkBtn" target="_blank"> 링크 버튼</a>
  <!-- blank: 빈 창에 띄워라 -->
  <a href="https://sports.news.nate.com/view/20240801n05190?mid=s9810" class="linkBtn"> link button</a>
  <a href="https://sports.news.nate.com/view/20240801n05190?mid=s9810" class="linkBtn2"> link button</a>

  <hr />

</body>
</html>

See the Pen Untitled by 유레이나 (@zdixexqp-the-reactor) on CodePen.

 
height대신 padding을 쓰는 이유:block태그는 vertical align이 적용x td에서는 먹지만 a태그에는 inline-block을 줘도 vertical 적용x

table(block)은 vertical-align이든 padding이든 다 먹히긴 한다. 그런데 block태그와 inline태그에서는 태그에따라서 적용될 수 있는 속성이 다르기때문에 여러가지 속성을 활용해 볼 수 있도록 할 것.
참고:https://www.w3.org/TR/CSS2/tables.html#height-layout

Tables

This chapter defines the processing model for tables in CSS. Part of this processing model is the layout. For the layout, this chapter introduces two algorithms; the first, the fixed table layout algorithm, is well-defined, but the second, the automatic ta

www.w3.org

 

 length - 패딩을 px, pt(ponit,1/72inch), cm,%등으로 지정가능
 참조:https://www.w3schools.com/css/css_padding.asp

W3Schools.com

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

 

font name ex)Courier New,D2Coding, 
font family:후보 없을때 쓰게 함ex)monospace(코딩용),cursive(필기체)등 
참조: https://www.w3schools.com/css/css_font.asp
반응형

'HTML|CSS' 카테고리의 다른 글

[html/css] Selector(선택자) 총 정리  (0) 2024.08.04
[html/css]favicon 사용, map태그, area태그, 이미지 좌표 확인 방법, 다각형 링크  (0) 2024.08.04
[html/css] 다양한 표현 방식  (0) 2024.08.03
[html/css] 로그인/회원가입 창 구현  (0) 2024.08.02
[html/css] Input type  (0) 2024.08.02
'HTML|CSS' 카테고리의 다른 글
  • [html/css] Selector(선택자) 총 정리
  • [html/css]favicon 사용, map태그, area태그, 이미지 좌표 확인 방법, 다각형 링크
  • [html/css] 다양한 표현 방식
  • [html/css] 로그인/회원가입 창 구현
라텐느
라텐느
이제 막 개발을 시작한 초보가 개인공부를 하는 공간입니다.
  • 라텐느
    괴발개발
    라텐느
    • 개발자 (154)
      • HTML|CSS (14)
      • JAVA (29)
      • JAVACSCRIPT (15)
      • SQL (16)
      • 기타 (5)
      • JSP (2)
      • SPRING (13)
      • SPRING BOOT (6)
      • Git&GitHub (1)
      • 시행착오 (2)
      • 개발일지 (35)
        • GreenMiniProject1 (12)
        • GreenMiniProject2 (9)
        • GreenFinalProject (14)
      • Flutter (5)
      • 자격증 (0)
        • SQLD (1)
      • AWS (2)
      • Linux (1)
      • 자료구조&알고리즘 (4)
  • 블로그 메뉴

    • 홈
    • 방명록
    • 태그
  • 링크

    • GitHub
  • 공지사항

  • 인기 글

  • 태그

    오블완
    HTML
    자기계발
    java
    태그
    JS
    link
    일지
    javascript
    db
    부트캠프
    링크
    CSS
    개발자
    tag
    SQL
    JQuery
    input
    티스토리챌린지
    AJAX
  • 최근 댓글

  • 최근 글

  • 반응형
  • hELLO· Designed By정상우.v4.10.0
라텐느
[html/css]링크 버튼 만들기,vertical align
상단으로

티스토리툴바