CSS, границы раздела отображаются как двойные

#css

#css

Вопрос:

Я не силен в CSS, но я не понимаю, что здесь происходит… кто-нибудь может пролить свет? я искал только одно поле div

 <html>
  <head>
  <style>
    html,
    #presenter{
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
  </style>
  </head>
  <body>
        <div id='presenter'>
        </div>
  </body>
</html>
 

введите описание изображения здесь

Комментарии:

1. И в чем вопрос?

2. Это не двойная граница. вы предоставляете границу html и div вместе. Скорее дайте отдельный css для обоих.

Ответ №1:

Это потому, что вы также добавляете границу к html тегу. Удалите его ссылку из css, и он будет работать: http://jsfiddle.net/Eta8G /

 #presenter{
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
 

Ответ №2:

Это html, часть вашего css. Отбросьте это.

 <html>
  <head>
  <style>
    #presenter{
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
  </style>
  </head>
  <body>
        <div id='presenter'>
        </div>
  </body>
</html>
 

Ответ №3:

Поведение связано с тем, что вы применяете стиль ко всему html-документу, а также к контейнеру div.

 html, #presenter {
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
 

итак, одна граница html-документа и одна из ваших div.

Вам просто нужно использовать #presenter не html

 #presenter {
  //
}
 

Ответ №4:

Вы также применили границу для HTML. Так что вы получаете две границы. Удалите html из стиля.

  <html>
<head>
<style>
  #presenter{
  position: fixed;
  width: 150px;
  height: 150px;
  border-style: dashed;
  border-color: red;
}
</style>
</head>
<body>
    <div id='presenter'>
    </div>
</body>
</html>
 

Ответ №5:

удалить html из css

     #presenter{
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
 

Ответ №6:

Вы также предоставляете стили для html

    html, #presenter{
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
 

изменить на

     #presenter{
      position: fixed;
      width: 150px;
      height: 150px;
      border-style: dashed;
      border-color: red;
   }
 

Ответ №7:

Удалите html из css.

 #presenter {
  position: fixed;
  width: 150px;
  height: 150px;
  border-style: dashed;
  border-color: red;
}