haben noch Platz nach margin, padding, border alle null?

Habe ich margin, padding und border auf null, doch es ist immer noch Platz um meine Leinwände und divs im Firefox und Chrome. Klar, ich verstehe nicht, wie man gemütlich bis-Elemente in HTML, und wäre dankbar für Tipps & Hinweise.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Spacing Question</title>
<style type="text/css">
    *
    {
        border: 0px;
        margin: 0px;
        padding: 0px;
    }
    canvas
    {
        width: 150px;
        height: 150px;
    }
    body
    {
        background-color: Purple;
        color: Silver;
    }
</style>
<script>
    function draw() {
        var canvas = document.getElementById('canvas1');
        if (canvas.getContext) {
            var ctx = canvas.getContext('2d');
            ctx.fillStyle = "rgb(200, 0, 0)";
            ctx.fillRect(0, 0, 150, 150);
        }
        canvas = document.getElementById('canvas2');
        if (canvas.getContext) {
            var ctx = canvas.getContext('2d');
            ctx.fillStyle = "rgb(0, 200, 0)";
            ctx.fillRect(0, 0, 150, 150);
        }
    }
</script>
</head>
<body onload="draw()">
<canvas id="canvas1" width="150" height="150">
    Fallback content 1.
</canvas>
<canvas id="canvas2" width="150" height="150">
    Fallback content 2. 
</canvas>
<div id="allYourControls">
</div>
</body>
</html>
Leinwand ist kein Gültiger tag in HTML 4.0.
Wo sehen Sie HTML 4.0 in dieser Frage?
doctype.
Woops - hatte gescrollt, sah nur <html>. Mein schlechtes.
Ich fand diese Frage, denn ich hatte ein anderes Problem mit den Raum um sich herum eine Leinwand. Wenn Sie hinzufügen <!doctype html> an der Spitze, und fügen Sie so etwas wie <div style='border:1px solid white'> um Ihre Gemälde, die Sie sehen können Raum darunter, innerhalb des div-Grenze. Um loszuwerden dieser, Satz vertical-align:bottom auf der Leinwand.

InformationsquelleAutor Reb.Cabin | 2011-05-01

Schreibe einen Kommentar