JSFiddle - React, Tailwind, and code Playground
by Daniel Hall
HTML
<div id="inputWords">
<ul>
<li>
<input type="text" id="adj1">
<br>to A_D logo
</li>
<!-- put other input fields here -->
</ul>
</div>
<div id="story">
</div>
<button id="replaceButton">read your text</button>
<div id="body"><p>lego</p></div>
<div id="head"></div>
<div class="eye" id="righteye"></div>
<div class="eye" id="lefteye"></div>
<div class="arm" id="rightarm"></div>
<div class="arm" id="leftarm"></div>
<div id="mouth"></div>
CSS
body {
font-family: "Comic Sans MS";
}
p {
font-size: 1.6em;
color: red;
}
#inputWords {
float:left;
width: 45%;
}
ul {
list-style-type: none;
padding: 0px;
margin: 0px;
}
li {
line-height: 2em;
text-transform: uppercase;
margin-top: 8px;
}
input[type=text] {
border-width: 0 0 1px 0;
border-color: #333;
}
#buttonDiv {
text-align: center;
}
#replaceButton {
margin-top: 30px;
width: 200px;
}
#story {
margin-top: 12px;
width: 45%;
border: 1px dashed blue;
padding: 8px;
float: left;
}
.replacement {
text-decoration: underline;
text-transform: uppercase;
}
#body {
position: absolute;
left: 50%;
top: 50%;
width: 20%;
height: 25%;
background-color: blue;
text-align:center;
}
#head {
position: absolute;
top: 38%;
left: 52%;
width: 15%;
height: 12%;
background-color: yellow;
border-radius: 15px;
}
.eye {
background-color: black;
width: 2%;
height: 2%;
border-radius: 50%;
}
#righteye {
position: absolute;
left: 54%;
top: 41%;
}
#lefteye {
position: absolute;
left: 62%;
top: 41%;
}
.arm {
background-color: yellow;
width: 5%;
height: 18%;
}
#rightarm {
position: absolute;
left: 45%;
top: 50%;
}
#leftarm {
position: absolute;
left: 70%;
top: 50%;
}
#mouth {
position: absolute;
left: 55%;
top: 46%;
width: 8%;
height: 1%;
background-color: black;
}
body {
background-color: green;
}
JavaScript
var replaceButton = document
.getElementById("replaceButton");
replaceButton.addEventListener("click",replaceIt);
function replaceIt() {
var storyDiv = document.getElementById("story");
var adj1 = "<span class='replacement'>"+ document
.getElementById("adj1").value + "</span>";
/* Insert more varible definitions here */
var theStory = "<h1>From Lego G_S</h1>";
theStory += "" + adj1 + "";
/* Put the the story here, using the +=
operator */
storyDiv.innerHTML = theStory;
}