๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Lect & Tip/html, css, scss

SASS SCSS aํƒœ๊ทธ ์•„๋ž˜ ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์ƒ‰ ์š”์†Œ๋ฅผ a:hover ์ƒ‰์€ ๊ฐ™๊ฒŒ ํ•˜๊ธฐ

by ๋‚ฏ์„ ๊ณต๊ฐ„2019 2019. 11. 18.

๋ชฉ์ฐจ

    โœˆSASS SCSS aํƒœ๊ทธ ์•„๋ž˜ ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์ƒ‰ ์š”์†Œ๋ฅผ a:hover ์ƒ‰์€ ๊ฐ™๊ฒŒ ํ•˜๊ธฐ

     SASS SCSS aํƒœ๊ทธ ์•„๋ž˜ ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์ƒ‰ ์š”์†Œ๋ฅผ a:hover ์ƒ‰์€ ๊ฐ™๊ฒŒ ํ•˜๊ธฐ.

    ๋˜๊ฒŒ ๊ฑฐ์ฐฝํ•œ ํ‘œํ˜„๊ฐ™์ง€๋งŒ ๋ณ„๊ฑฐ ์•„๋‹ˆ๋‹ค.

    ๋‹ค๋งŒ SCSS์˜ ๊ตฌ์กฐ์— ๋Œ€ํ•ด์„œ ์„ค๋ช…ํ•˜๊ธฐ ์œ„ํ•œ ๊ธ€์ด๋‹ค.

    ์œ„์™€ ๊ฐ™์€ ๊ฒฝ์šฐ ํ…์ŠคํŠธ ์˜์—ญ์— ๋งํฌ๋Š” ํ•˜๋‚˜๋‹ค.

    ๋งˆ์šฐ์Šค์˜ค๋ฒ„๊ฐ€ ๋˜์—ˆ์„ ๋•Œ ๋ฌธ๋‹จ ๋ณ„๋กœ ์ƒ‰์ด ๋ฐ”๋€Œ๋ฉด ์•ˆ๋˜๊ณ , ์ „์ฒด๊ฐ€ ์ƒ‰์ด ๋ฐ˜์ „์ด ๋˜์–ด์•ผ ํ•œ๋‹ค.

    ๊ฐ๊ฐ ์Šคํƒ€์ผ์„ ์ฃผ์–ด๋„ ๋˜์ง€๋งŒ, SCSS์—์„œ๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

    html

    	<ul class="latest">
    	  <li>
    	    <div class="card">
    	      <!-- card innerWrap : hold width -->
    	      <div class="cardInnerWrap">
    	        <div class="overThumb">
    	          <span class="thumb card-img-top">
    	            <img src="/assets/images/~mockup/s1.png"></span>
    	        </div>
    	        <div class="card-body"><a href="/pb_contents/publish/publish_view.php">
    	            <p class="contentCate">Contents</p>
    	            <p class="CotentTitle">์ŠคํŽ˜์ธํ•˜์ˆ™ 3ํ™”</p>
    	            <p class="card-text">๋ฏธ์•ˆํ•˜์ง€๋งŒ, ๋‚œ ๋‹น์‹ ๋“ค์ด ๊ถ๊ธˆํ•˜์ง€ ์•Š์•„์š”๋ฏธ์•ˆํ•˜์ง€๋งŒ, ๋‚œ ๋‹น์‹ ๋“ค์ด ๊ถ๊ธˆํ•˜์ง€ ์•Š์•„์š”๋ฏธ์•ˆํ•˜์ง€๋งŒ, ๋‚œ ๋‹น์‹ ๋“ค์ด ๊ถ๊ธˆํ•˜์ง€ ์•Š์•„์š”</p>
    	          </a>
    	        </div>
    	        <!-- card innerWrap : hold width -->
    	      </div>
    	    </div>
    	  </li>

    ์ด๋Ÿฐ ๊ตฌ์กฐ์ผ ๋•Œ

    SCSS

    SCSS ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ตฌ์„ฑํ•œ๋‹ค.

      .card {
        border: 0 none;
        border-radius: 0;
    
        .cardInnerWrap {
          display: inline-flex;
    
          .thumb {
            width: 133px;
            height: 75px;
          }
    
          .card-body {
            padding: 0 1.25rem;
            width: calc(100% - 150px);
    
            a {
    
              &:hover p,
              &:focus p {
                color: #5e7fdc;
              }
    
              .contentCate {
                color: #AAAAAA;
              }
    
              .CotentTitle,
              .card-text {
                display: block;
                text-overflow: ellipsis;
                overflow: hidden;
                white-space: nowrap;
                color: #555555;
              }
            }
          }
        }
      }
    }

    ์น˜ํ™˜์ž &์„ ์‚ฌ์šฉํ•ด์„œ :hover์™€ :focus๋ฅผ ๋ฐ›์œผ๋ฉด ์•„๋ž˜์˜ P ์Šคํƒ€์ผ์„ ๋ณ€๊ฒฝํ•˜๋ผ๋กœ ๋ณด๋ฉด ๋œ๋‹ค.

    ๋ฐ˜์‘ํ˜•

    ๋Œ“๊ธ€