質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

Q&A

解決済

1回答

1603閲覧

ナビゲーションの上の余白を無くしたいです

kurumi_chester

総合スコア2

HTML

HTMLとは、ウェブ上の文書を記述・作成するためのマークアップ言語のことです。文章の中に記述することで、文書の論理構造などを設定することができます。ハイパーリンクを設定できるハイパーテキストであり、画像・リスト・表などのデータファイルをリンクする情報に結びつけて情報を整理します。現在あるネットワーク上のほとんどのウェブページはHTMLで作成されています。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

0グッド

0クリップ

投稿2021/06/05 17:40

編集2021/06/06 04:22

背景画像の上にナビゲーションを表示させたいのですが、ナビゲーションのpaddingが邪魔をして上手くいきません。paddingを消したり、position:absolute,position:relativeの関係も見直したのですが、よくわかりません。
分かる方がいらっしゃいましたら、回答よろしくお願い致します。

htmlコード

<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Cresta Design | 快適なオフィスをデザインする会社</title> <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700&family=Noto+Serif:ital,wght@0,400;0,700;1,700&display=swap" rel="stylesheet"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700&family=Noto+Serif:ital,wght@0,400;0,700;1,700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="./css/reset.css"> <link rel="stylesheet" href="style.css"> </head> <body> <!-- header -->  <header class="header"> <div class="header-inner"> <h1 class="site-title"><a href="./"></a>Cresta Design</h1> <nav class="header-nav"> <ul class="nav-list"> <li class="nav-item"><a href="">Concept</a></li> <li class="nav-item"><a href="">Service</a></li> <li class="nav-item"><a href="">Works</a></li> <li class="nav-item"><a href="./contact/">Contact</a></li> </ul> </nav> <button class="burger-btn"> <span class="bar bar-top"> </span> <span class="bar bar-mid"></span> <span class="bar bar-bottom"></span> </button> </div> </header> <!-- header --> <!-- main --> <main> <div class="fv"> <div class="main-copy"> <p class="en-copy">Design for Smile.</p> <p class="jp-copy">快適なオフィスをデザインする</p> </div> </div> <!-- fv -->
<!-- concept --> <section class="section-wrapper"> <h2 class="section-title">CONCEPT</h2> <div class="section-inner"> <p class="concept-lead">“働きたくなる空間”をデザインすることで<br> 人々を幸せにする。</p> <div class="concept-content"> <p class="concept-text">私たちは、オフィスに特化した空間デザイン専門としております。その理由は、「働きたくなる空間で仕事ができれば多くの人を幸せにできるのではないか」と考えるためです。そんな想いの株式会社Cresta Designだからこそできる空間デザインを提供させていただきます</p> <div class="concept-img-wrapper"> <img src="./img/concept-image@2x.jpg" alt=""> </div> </div> </div> <div class="section-bottom text-right">Our Concept</div> </section> <!-- works --> <section class="section-wrapper bg-works"> <h2 class="section-title text-right text-white">Works</h2> <ul class="works-list"> <li class="works-item"> <a href="#!"> <div class="works-list-img"><img src="./img/card-img01@2x.jpg" alt=""></div> <p class="works-list-text">新規サイトを公開しました。今回のサイトは白と黒を基調にしたミニマルなデザインになっています。</p> </a> </li> <li class="works-item"> <a href="#!"> <div class="works-list-img"><img src="./img/card-img02@2x.jpg" alt=""></div> <p class="works-list-text">新規サイトを公開しました。今回のサイトは白と黒を基調にした</p> </a> </li> <li class="works-item"> <a href="#!"> <div class="works-list-img"><img src="./img/card-img03@2x.jpg" alt=""></div> <p class="works-list-text">新規サイトを公開しました。今回のサイトは白と黒を基調にしたミニマルなデザインになっています。</p> </a> </li> </ul> <a href="" class="link-btn">View more</a> <div class="section-bottom text-white">Our Works</div>
</section> <!-- //works --> <!-- service --> <section class="section-wrapper"> <h2 class="section-title">Service</h2> <ul class="service-list"> <li class="service-item service1"><a href="">Hearing</a></li> <li class="service-item service2"><a href="">Planning</a></li> <li class="service-item service3"><a href="">Direction</a></li> </ul> <div class="section-bottom">Our Service</div> </section> <!-- //service -->
<!-- contact --> <section class="section-wrapper bg-contact"> <h2 class="section-title text-right text-white">Contact</h2> <div class="section-inner"> <p class="contact-text">お気軽にご相談ください</p> <a href="./contact/" class="link-btn">Contact</a> </div> <div class="section-bottom text-white">Contact us</div>
</section>
<!-- //contact -->
</main> <!-- //main --> <footer class="footer"> <small>&copy;cresta.design all rights reserved</small> </footer> </body> </html>

cssコード

/* ---base---- */
html{
font-size: 62.5%;
}
body{
font-size: 1.6rem;
letter-spacing: .05em;
color: #171717;
font-family: 'Noto Serif','Noto Serif JP', serif;
}
img{
vertical-align: bottom;
width: 100%;
}
.section-wrapper{
padding: 100px 0 70px;
}
.section-title{
max-width: 1000px;
color: #282f35;
font-size: 6rem;
font-style: italic;
margin: 0 auto 80px;
padding: 0 20px;
}
.section-title::after{
content: "";
display: inline-block;
background-color: #282F35;
width: 200px;
height: 5px;
margin-left: 30px;
vertical-align: middle;

}
.section-inner{
max-width: 1000px;
margin: 0 auto;
padding: 0 50px;
}
.section-bottom{
max-width: 1200px;
margin: 0 auto;
font-size: 9rem;
opacity: .05;
}
.section-bottom.text-white{
opacity: .1;
}
.text-right{
text-align: right;
}
.text-white{
color: #fff;
}
.section-title.text-white::after{
background-color: #fff;
}
.link-btn{
display: block;
width: 235px;
line-height: 60px;
margin: 0 auto 70px;
background-color: #f7d43f;
box-shadow: 0 0 6px #1b1310;
border-radius: 30px;
text-align: center;
color: #171717;
font-weight: bold;
text-decoration: none;
transition: .3s;
}
.link-btn:hover{
opacity: .7;
transition: .3s;
}
.text-right{
text-align: right;
}
.text-white{
color: #fff;
}
.section-title.text-white::after
.sp-br{
display: none;
}
/* ---header---- */
.header{
padding: 19px 30px;
position: absolute;
top: 0;
left: 0;
z-index: 1;
box-sizing: border-box;
width: 100%;
}
.header-inner{
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
margin: 0 auto;

}
.header a{
color: #fff;
text-decoration: none;
transition: .3s;
font-weight: bold;
font-style: italic;
}
.header a:hover{
opacity: .7;
transition: .3s;
}
.site-title{
font-size: 2.6rem;
color: #fff;
}
.nav-list{
display: flex;
}
.nav-item{
margin-right: 30px;
}
.nav-item:last-of-type{
margin-right: 0;
}
.burger-btn{
display: none;
}

/* first view */

.fv{
height: 100vh;
min-height: 550px;
position: relative;
background-image: url(./img/fv-bgi_01@2x.jpg);
background-size: cover;
background-position: center;
}

.main-copy{
position: absolute;
left: 120px;
bottom: 177px;
color: #fff;
}
.en-copy{
font-size: 7rem;
margin-bottom: 31px;
}
.jp-copy{
font-size: 4rem;
text-align: center;
}

/* ---concept--- /
.concept-lead{
text-align: center;
font-size: 3rem;
margin-bottom: 60px;
font-weight: bold;
line-height: 1.7;
}
.concept-content{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 70px;
}
.concept-text{
max-width: 440px;
line-height: 1.9;
font-weight: bold;
}
.concept-img-wrapper{
max-width: 440px;
margin-left: 20px;
}
/
---works--- */

.bg-works{
background-image: url(./img/works-bgi@2x.jpg);
background-size: cover;
background-position: center;
}
.works-list{
max-width: 1000px;
margin: 0 auto 80px;
padding: 0 50px;
display: flex;
justify-content: space-between;
}
.works-item{
width: 32%;
background-color: #fff;

}
.works-item a{
color: #141414;
text-decoration: none;
}
.works-list-text{
padding: 25px 20px;
}

/* ---service--- */
.service-list{
display: flex;
}

.service-item{
width: 33.3%;
}
.service-item.service1{
background-image: url(./img/service-img01@2x.jpg);
}
.service-item.service2{
background-image: url(./img/service-img02@2x.jpg);
}
.service-item.service3{
background-image: url(./img/sevice-img03@2x.jpg);
}
.service-item a{
text-decoration: none;
display: block;
width: 100%;
text-align: center;
color: #fff;
line-height: 320px;
font-size: 4rem;
font-weight: bold;
font-style: italic;
transition: .3s;
}
.service-item a:hover{
background-color:rgba(40,47,53,7);
transition: .3s;
}

/* ---contact--- */

.bg-contact{
background-image: url(./img/contact-bgi@2x.jpg);
background-size: cover;
background-position: center;
}
.contact-text{
text-align: center;
color: #fff;
font-size: 2rem;
margin-bottom: 40px;
}

/* ---footer--- */

.footer{
padding: 30px 0;
text-align: center;
font-size: 1.4rem;
font-weight: bold;
color: #282f35;
}

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kansuke_t

2021/06/05 17:48

```html コード ``` のようにすると回答を得られやすくなりますよ。
m2l

2021/06/05 21:33

一つ質問よろしいでしょうか? ナビゲーションというのはコードで言いますとどの部分を指しますでしょうか? それがわかるとお答えできるかと思います。 (該当箇所のスクリーンショットもありますとよりスムーズにお答えできます。)
hope_mucci

2021/06/06 00:51

見たところクリスタ課題の解答コードほぼそのままと見受けられますが、解答そのものの再現を目指しているのでしょうか?それとも独自にアレンジしたい? スクリーンショット等を使って「現状はこのようになっている」「目標はこのようにしたい」状態を図示すると回答が付きやすいと思います。 あと、他の方も仰るようにコードは```と```で括りましょう。右側のプレビューもしっかり確認してから投稿してください。
kurumi_chester

2021/06/06 04:27

こんにちは。 ご指摘ありがとうございます。 次回以降気を付けて質問させていただきます。 このコードはクリスタの課題をYouTubeで解説している動画を見ながら作成したものです。 ナビゲーションはheader-navの部分です。 よろしくお願いいたします。
guest

回答1

0

ベストアンサー

該当の画像がないため、明確な回答でないことご了承くださいませ。
下記のreset.cssは今開発されているcssフォルダの中に入っている形でしょうか?
こちらがないため、空白が入ってしまっているのかなと思いました。

<link rel="stylesheet" href="./css/reset.css">

投稿2021/06/06 04:37

m2l

総合スコア318

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kurumi_chester

2021/06/06 05:09

上の余白が消えました!!ありがとうございました!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問