簡體   English   中英

CSS 不工作

[英]CSS doesn't work

我想創建一個網站。

先決條件

CSS 不起作用。

期望值

我想將 logo.svg 的大小設置為 width: 120px;,height: 40px;。

復制程序

運行下面的代碼。

index.html

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>ポートフォリオサイト1</title>
    <link rel="stylesheet" href="./dist/css/header.css" type="text/css">
</head>
<body>
    <header class="header">
        <a href="index.html" class="header__profile-button"><img src="image/logo.svg" alt="プロフィール"></a>
        <nav class="header__breadcrumb-trail">
                <a href="" class="header__breadcrumb-trail">About</a>
                <a href="" class="header__breadcrumb-trail">Bicycle</a>
        </nav>
    </header>
    <main class="main">
        <div class="main__mainvisual">
            <img class="main__mainvisual-image" src="image/mainvisual (1).jpg" alt="メインビジュアル">
        </div>

        <div class="main__about">
            <p class="main__about-title">About</p>
            <img class="main__profile-icon-image"src="image/about.jpg" alt="プロフィールアイコン">
            <p class="main__name-text">Yusuke Oyama</p>
            <p class="main__introduction-text">
                初めまして。atago_ITと申します。
                とある開発コミュニティで、QAエンジニアをやっています。
                自転車と萬年筆が大好きです。よろしくお願いいたします。
            </p>
        </div>

        <div class="bicycle">
           <div class="bicycle__bicycle-image">
                <img src="image/bicycle1.jpg" alt="">
           </div> 
           <div class="bicycle__bicycle-image">
                <img src="image/bicycle2.jpg" alt="">
           </div>
           <div class="bicycle__bicycle-image">
                <img src="image/bicycle3.jpg" alt="">
           </div>
        </div>
    </main>
    <footer class="footer">
        <p class="footer__text">
            ©2021 atago_IT
        </p>
    </footer>
</body>
</html>

header.css

.header .header__profile_button {
  width: 120px;
  height: 40px;
}

這看起來是一個非常簡單的錯誤,很容易被忽視。 In your HTML, the <a> tag that surrounds your <img> has a class of header__profile-button whereas, your CSS calls for the class .header__profile_button . 只需更改其中一個以使兩者匹配,它應該可以順利運行。

可能有用的來源: https://www.w3schools.com/cssref/sel_class.asp

不用擔心,這只是一個小錯字。 (.header__profile_button 與 .header__profile-button)

你在使用 Visual Studio 代碼嗎? 一旦你 select 一個文本,這個編輯器將顯示所有實例。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM