πŸ”Ž HTML (5-2)

μ„œκ°€ν¬Β·2022λ…„ 4μ›” 5일
0

HTML

λͺ©λ‘ 보기
6/6
post-thumbnail

1. 블둝 레벨 μš”μ†Œ

λΈ”λ‘μš”μ†ŒλŠ” ν•œ 개의 λ…λ¦½λœ λ©μ–΄λ¦¬λ‘œ ν™”λ©΄μ˜ κ°€λ‘œ 폭 전체λ₯Ό μ°¨μ§€ν•˜λŠ” μš”μ†Œλ“€μ„ 말함.
λΈ”λ‘μš”μ†Œλ₯Ό μ‚¬μš©ν•˜λ©΄ 라인이 λ°”λ€œ.
λΈ”λ‘μš”μ†ŒλŠ” λΈ”λ‘μš”μ†Œμ™€ μΈλΌμΈμš”μ†Œλ₯Ό λͺ¨λ‘ 포함할 수 있음(λ‚΄κ°€ ν—·κ°ˆλ Έλ˜ 것).
λŒ€ν‘œμ μΈ 블둝 μš”μ†ŒλŠ” <article>, <header>, <nav>, <section>, <div>

2. 인라인 μš”μ†Œ

인라인 μš”μ†ŒλŠ” 컨텐츠 μžμ‹ μ˜ 크기 만큼 μ˜μ—­μ„ κ°€μ§€λŠ” μš”μ†Œλ₯Ό 말함.
인라인 μš”μ†Œλ“€μ€ 인라인 μš”μ†Œλ§Œ 쀑첩이 κ°€λŠ₯.
인라인 μš”μ†Œμ˜ 정렬은 ν…μŠ€νŠΈ μ •λ ¬μ˜ 영ν–₯을 λ°›μŒ.
λŒ€ν‘œμ μΈ 인라인 μš”μ†Œλ‘œλŠ” span, strong λ“±

<style>
        p {
            display: block;
            background-color: red;
        }
        span {
            background-color: blue;
        }
    </style>
</head>
<body>
    <p>hello world</p>
    <div class="one">
        <span>hello world</span>
        <span>hello world</span>
    </div>
</body>

λΈ”λ‘μš”μ†Œ VS 인라인 μš”μ†Œ

λΈ”λ‘μš”μ†ŒλŠ” 높이와 넓이 κ°’ 쑰절 β­• , 인라인 μš”μ†ŒλŠ” 높이와 넓이 κ°’ 쑰절 ❌

인라인 μš”μ†ŒλŠ” 높이와 넓이 κ°’ 쑰절이 μ•ˆλ¨ πŸ‘‰ <display: block > , <display: inline-block > 을 μ‚¬μš©

display: inline-block

높이 넓이 μ‘°μ •ν•˜λ‚˜ μ˜†μœΌλ‘œ λΆ™μ–΄ 있고 싢을 λ•Œ μ‚¬μš©

<style>
  p{
    display: block;
    width: 300px;
    height: 300px;
    background-color: yellowgreen;
  }
  span{
    display: inline-block;
    width: 150px;
    height: 150px;
    background-color: teal;
  }
</style>
<body>
    <p>hello world</p>
    <span>hello world</span>
    <span>hello world</span>
</body>

😲 inline μš”μ†Œμ˜ 문제점

span λ°•μŠ€λ“€ μ‚¬μ΄μ˜ 곡간이 생긴 μ΄μœ λŠ” ? spanνƒœκ·Έλ“€ μ‚¬μ΄μ˜ μ—”ν„°ν‚€ λ•Œλ¬Έμ— λ°œμƒ

<body>
    <p>hello world</p>
    <span>hello world</span><span>hello world</span>
</body>

ν•˜μ§€λ§Œ ν•΄κ²°ν•˜κΈ° μœ„ν•΄ μ΄λŸ°μ‹μœΌλ‘œ 코딩은 ❌❌❌

πŸ‘ 해결방법

  1. font-size: 0; 일뢀 λΈŒλΌμš°μ €μ—μ„œ μ•ˆλ¨ΉλŠ” 경우있음
  2. enter λ₯Ό μ‚­μ œ (like μœ„ μ½”λ“œ => 쒋지λͺ»ν•œλ°©λ²•)
  3. -margin을 쀌 . 폰트 μ’…λ₯˜κ°€ 달라지면 λ”± λ§žμ•„ 떨어지지 μ•ŠμŒ (μ•„λž˜ μ—¬λ°±λ¬Έμ œ)
  4. float
<style>
span{
    font-size: 1rem;
    display: inline-block;
    width: 150px;
    height: 150px;
    background-color: blue;
  }
  .one {
    font-size: 0; βœ…βœ…βœ…
  }
</style>

<div class="one">
      <span>hello world</span>
      <span>hello world</span>
</div>


여백이 λ‹¬λΌμ§€λŠ” 문제점이 λ°œμƒ (os λ§ˆλ‹€ λ‹€λ₯Έ 것 κ°€νƒ€μš”)
폰트의 μ‚¬μ΄μ¦ˆμ— μ˜ν•΄ 여백이 λ‹¬λΌμ§€λŠ” 문제

<style>
.one {
	font-size: 0;
}
.two {
    display: inline;
    font-family: 'Rubik Wet Paint', cursive;
}
.three {
    line-height: 1;
    βœ…βœ… 1 == 16px
}
</style>

<body>
  <p>p</p>
 <div class="one">
  <span>span</span>
  <span>span</span>
 </div>


 <div class="three">
  <span class="two">H</span>ello
  <span class="two">H</span>ello
 </div>

</body>

쒋은 방법 μ•„λ‹ˆμ—μš”!! πŸ‘‰ μ•Œμ•„κ°€κΈ°

β˜‘ μΆ”κ°€ 말씀

<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Summernote with Bootstrap 4</title>
    <!-- Toast Editor 2.0.0κ³Ό μ˜μ‘΄μ„± -->
    <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />
    <script src="https://uicdn.toast.com/editor/latest/toastui-editor-all.min.js"></script>
  </head>
  <body>
    <!-- ν•΄λ‹Ή μ˜ˆμ œλŠ” bootstrap μ‹œκ°„μ— ν–ˆμ—ˆμŠ΅λ‹ˆλ‹€. -->
    <div id="editor"></div>
    <script>
        const Editor = toastui.Editor;
 
        const editor = new Editor({
            el: document.querySelector('#editor'),
            height: '600px',
            initialEditType: 'markdown',
            previewStyle: 'vertical'
        });
        
        // editor.getHTML()
        // editor.getMarkdown()
    </script>
  </body>
</html>

div νƒœκ·Έμ΄λ‹ˆκΉŒ λ²„νŠΌ λˆŒλ €μ„ λ•Œ submit λ™μž‘ λͺ»ν•˜λŠ”데 μ •μƒμ μœΌλ‘œ submit을 ν•˜κ³  μžˆλ„€ ?
πŸ‘‰ input hidden은 이럴 λ•Œ μ‚¬μš©!!
input hidden μ¨μ„œ input에 data λ„£μ–΄μ€Œ. μ œμΆœλ˜λŠ” κΈ°λŠ₯을 κ°€μ Έμ˜€κΈ° μœ„ν•΄ input κ°€μ Έμ™”λ‹€κ³  μƒκ°ν•˜λ©΄ 될 λ“―

πŸ™†πŸ»β€β™€οΈ 회고


μš”μ¦˜ λ„ˆλ¬΄λ„ˆλ¬΄ ν”Όκ³€ν•˜λ‹€ γ… γ…  흑 μ»¨λ””μ…˜ 쑰절 μž˜ν•˜κΈ° ~.~

0개의 λŒ“κΈ€