首页 > 解决方案 > 即使完成链接href,将HTML链接到CSS也有问题,文件位于同一文件夹中

问题描述

试图开始我的编码之旅并遇到了一个问题。有 2 段文本,一段 html 和一段 css,我无法将它们链接在一起。他们来了:

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="/css-stuff.css">  
  </head>
  <body bgcolor = brown>
  <div class = "container">
    <img src="https://ih0.redbubble.net/image.427712605.8856/flat,750x,075,f-pad,750x1000,f8f8f8.jpg">
  <form id="outsideBox" method = "post">
    <ul style="list-style-type:none;">
      <li>
      <label for "email">Email: </label>
      <input type = "text" id="email" name="email_adress">
      </li>
      <li>
        <label for "password">Password</label>
        <input type = "text" id="password" name="pw_input">
      </li>
      <li class = "button">
        <button id="clickMe" type = "button"> Login</button>
      </li>
    </ul>
    </form> </div>
  </html>

和CSS:

body{
  background-image: url(https://images.unsplash.com/photo-1518839283416-0cc546d12a97?ixlib=rb-1.2.1&w=1000&q=80);
  background-repeat: round;
}
.container{

  background-image: url(https://img.pngio.com/purple-background-png-png-group-romolagaraiorg-1920_1080.png);
  /* form position */
  position: relative;
  top: 100px;
  left: 600px;
  /*---------------*/
  width: 267px;
  border-style: outset;
  padding: 10px;
  border-radius: 1em;
  display: inline-block;
  text-align: right
}
img{
  width:100px;
  height: 100px;
  border-radius: 50%;
  margin-right: 75px
  }
ul{
  color:white;
}

这是他们两个,他们在 codepen 上工作,但不会在 atom 中编译。

标签: htmlcss

解决方案


你应该把点和斜线放在相同的顺序。像这样 :

<link rel="stylesheet" href="./css-stuff.css"> 

推荐阅读