I'm using javascript to insert paragraphs inside a div. What it does is get the value of an input form when you click a button and append it into a specific div as a paragraph. The problem is that their margin is too big and I have no idea how to decrease them (make them closer). What do I do in this case?
jsfiddle - Anyway, my code looks like this:
<div id="red">
<button id="bt_1" onclick="addParagraph()">Add</button>
<form>
<input id="box_top" type="text" placeholder="Spacing is too big -->">
</form>
</div>
<div id="blue">
<!--Paragraphs that are being added here have their top and bottom margin too big, but I don't know how to fix it.-->
<!--Type something in thet input form and keep clicking the add button to see what I mean.-->
</div>
#blue {
height:100px;
width:250px;
margin-top: 10px;
float:left;
position:relative;
background-color:blue;
overflow:auto;
}
#red {
height:100px;
width:250px;
margin-top: 10px;
float:left;
position:relative;
background-color:red
}
form {
font-size: 12px;
font-family: Verdana, Arial, Sans-Serif;
display: inline-block;
}
#bt_1 {
margin-left:5px;
height:35px;
width:70px;
margin-top: 25px;
border-radius:5px;
}
function addParagraph() {
var word = document.getElementById("box_top").value;
var pMaker = document.createElement("p");
var nodeMaker = document.createTextNode(word);
pMaker.appendChild(nodeMaker);
var blueDiv = document.getElementById("blue");
blueDiv.appendChild(pMaker);
}