2016-06-16 8 views
-2

私は自動拡張divを使用してコードを表示しています。これは、コードの上のスペースの行とコードの下のスペースの行を示します。私はそれを削除したい。私はベストを尽くしたが失敗した。あなたはそれを助けてもらえますか?私はあなたのすべてのサポートに感謝します。ここではそれがどのように見えるかの画像である - これは私のコードdivの上と下の余分なスペースを削除する方法

.code{ 
 
    background-color: #d1e0e0; 
 
    font-family: 'Microsoft New Tai Lue', sans-serif; 
 
    font-size: 15px; 
 
    overflow: hidden; 
 
    height: auto; 
 
    width: 100%; 
 
}
<html> 
 
    <head> 
 
     <title>HTML Tutorial</title> 
 
     
 
    </head> 
 
    <body> 
 
     <div class="code" id="text"> 
 
      <xmp> 
 
         <!DOCTYPE html> 
 
         <html> 
 
          <head> 
 
           <title>HTML Tutorial</title> 
 
          </head> 
 
          <body> 
 
           This is a simple HTML page 
 
          </body> 
 
         </html> 
 
      </xmp>    
 
     </div> 
 
    </body> 
 
</html>
ある image of output

+0

codepenでウルのコードを入れたり – SESN

答えて

0

マージンとパディング0PX

element { margin: 0px; padding: 0px; } 
+0

私はそれを試してみましたがいじるようにしてください。動いていない。 –

+0

Uコードをフィドルに入れることはできますか? – SESN

0

使用それで、この場合は、あなたの大丈夫を与えます。それがあなたを助けることを願ってください。ありがとうございました。

.code{ 
 
    background-color: #d1e0e0; 
 
    font-family: 'Microsoft New Tai Lue', sans-serif; 
 
    font-size: 15px; 
 
    overflow: hidden; 
 
    height: auto; 
 
    width: 100%; 
 
} 
 
xmp { 
 
    margin: 0px; 
 
    line-height: 1;}
<html> 
 
    <head> 
 
     <title>HTML Tutorial</title> 
 
     
 
    </head> 
 
    <body> 
 
     <div class="code" id="text"> 
 
      <xmp> 
 
         <!DOCTYPE html> 
 
         <html> 
 
          <head> 
 
           <title>HTML Tutorial</title> 
 
          </head> 
 
          <body> 
 
           This is a simple HTML page 
 
          </body> 
 
         </html> 
 
      </xmp>    
 
     </div> 
 
    </body> 
 
</html>

かは、HTMLでの間隔を調整することができ

xmp{margin:-15px;} 
0
xmp { 
    margin-top: -15px; 
    margin-bottom: -15px; 
} 
1

ようnegetiveマージンを使用することができます。

.code{ 
 
background-color: #d1e0e0; 
 
font-family: 'Microsoft New Tai Lue', sans-serif; 
 
font-size: 15px; 
 
overflow: hidden; 
 
height: auto; 
 
width: 100%; 
 
}
<div class="code" id="text"> 
 
     <xmp>      <!DOCTYPE html> 
 
        <html> 
 
         <head> 
 
          <title>HTML Tutorial</title> 
 
         </head> 
 
         <body> 
 
          This is a simple HTML page 
 
         </body> 
 
        </html></xmp>    
 
    </div>

関連する問題