2016-05-26 7 views
0

Wie richte ich diese beiden am oberen Rand der div oder nur den Raum am unteren Rand der Leinwand loswerden?HTML5 - Padding unter Canvas-Element verursacht Ausrichtungsprobleme

<style> 
    html, body, div, canvas { 
     margin: 0; 
     padding: 0; 
    } 
</style> 
<div style="border: solid 1px Grey;"> 
    <a style="border: solid 1px Grey">Test</a> 
    <canvas style="border: solid 1px Grey;width:30px;height: 30px"></canvas> 
</div> 
+0

Stellen Sie die div 'Position: relative' und sowohl den Anker & Leinwand als' Position: absolute'. – markE

Antwort

0

<html> 
 
<head> 
 
    <title>Test</title> 
 
    <style> 
 
     .Left { 
 
      float: left; 
 
      border: 1px solid red; 
 
      width: 30px; 
 
     } 
 
     .Right { 
 
      float: left; 
 
      border: 1px solid green; 
 
      width: 35px; 
 
     } 
 
     .Outer { 
 
      border: solid 1px Grey; 
 
      height: 50px; 
 
      width: 100%; 
 
     } 
 
    </style> 
 
</head> 
 
<body> 
 
    <div class="Outer"> 
 
     <div class="Left"><a style="border: solid 1px Grey">Test</a></div> 
 
     <div class="Right"> 
 
      <canvas style="border: solid 1px Grey;width:30px;height:30px"> 
 
       <!--Your Canvas--> 
 
      </canvas> 
 
     </div> 
 
    </div> 
 
</body> 
 
</html>

Verwandte Themen