html 훈련 - (4) Logo in Header

frenchkebab·2021년 10월 21일
0

Logo in Header


😎 html


html 코드

<h1>
  <a href="./LogoInHeader.html"><img src="https://statics.goorm.io/logo/edu/goorm_edu.svg" alt="Goorm Edu" /></a>
</h1>
<a href="https://edu.goorm.io/qna">Q&amp;A</a>

결과 화면


😎 css


css를 입힌 코드

LogoInHeader.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Logo in Header</title>
  </head>
  <body>
    <div class="header">
      <h1>
        <a href="./LogoInHeader.html"><img src="https://statics.goorm.io/logo/edu/goorm_edu.svg" alt="Goorm Edu" /></a>
      </h1>
      <a href="https://edu.goorm.io/qna">Q&amp;A</a>
    </div>
  </body>
</html>

styles.css

@import url('https://fonts.googleapis.com/css?family=Noto+Sans+KR&display=swap');

* {
  margin: 0;
  box-sizing: border-box;
}

html {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  font-size: 16px;
  line-height: 1.5;
  color: #1f2d3d;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  background-color: #1f2d3d;
}

body::after {
  content: 'frenchkebab©';
  display: block;
  margin-top: 50px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  padding: 12px 56px;
  border-radius: 3px;
  background-color: #fff;
  box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.1);
}

.header h1 {
  position: relative;
  top: 1px;
}

.header h1 img {
  display: block;
  width: auto;
  height: 30px;
}

.header a {
  display: block;
  text-decoration: none;
  font-size: 0.875rem;
  color: #313338;
}

.header a:hover {
  opacity: 0.5;
}

.header a:visited {
  color: inherit;
}

결과 화면


😎 알아갈 점


이미지 자체에 텍스트가 들어있을 때?

다시 text를 넣어서 css로 가려주기 보다는, 그냥 alt값으로 해당 text를 넣어주면 된다!

profile
Blockchain Dev Journey

0개의 댓글