Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.6/d3.min.js"></script>
</head>
<body>
<script>
    var svg = d3.select('body')
    .append('svg')
    .attr('width', 100)
    .attr('height', 100)
    svg
    .append(function() { return document.createElement('rect')})
    .attr('x', 0)
    .attr('width', 10)
    .attr('height', 10)
    .attr('fill', 'red')
    svg
    .append('rect')
    .attr('x', 10)
    .attr('width', 10)
    .attr('height', 10)
    .attr('fill', 'blue')
</script>
    
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers