본문을 쉽게 읽을 수 있도록 전체 배경이나 텍스트 색상을 조정하는 대신 강조하려는 텍스트가 있는 요소에 배경색을 추가할 수 있습니다. 이 챌린지는 16진수 코드나 일반 rgb() 대신 rgba()를 사용합니다.
rgba stands for: r = red g = green b = blue a = alpha/level of opacity
RGB 값의 범위는 0에서 255까지입니다. 알파 값의 범위는 완전히 불투명하거나 단색인 1부터 완전히 투명한 0까지입니다. rgba()는 불투명도를 조정할 수 있으므로 이 경우에 사용하는 것이 좋습니다. 즉, 배경을 완전히 차단할 필요가 없습니다.
이 챌린지에는 background-color: rgba(45, 45, 45, 0.1)를 사용합니다. 낮은 불투명도 값이 0.1인 경우 거의 투명한 짙은 회색을 생성합니다.
텍스트를 더 돋보이게 하려면 h4 요소의 배경색을 지정된 rgba() 값으로 조정합니다.
또한 h4의 경우 height 속성을 제거하고 10px의 패딩을 추가합니다.
<style> h4 { text-align: center; padding: 10px; background-color: rgba(45,45,45,0.1); } p { text-align: justify; } .links { text-align: left; color: black; } .fullCard { width: 245px; border: 1px solid #ccc; border-radius: 5px; margin: 10px 5px; padding: 4px; } .cardContent { padding: 10px; } .cardText { margin-bottom: 30px; } </style> <div class="fullCard"> <div class="cardContent"> <div class="cardText"> <h4>Alphabet</h4> <hr> <p><em>Google was founded by Larry Page and Sergey Brin while they were <u>Ph.D. students</u> at <strong>Stanford University</strong>.</em></p> </div> <div class="cardLinks"> <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a><br><br> <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a> </div> </div> </div>
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.