JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="vytvorPost()">Vytvor post</button>
CSS
body{
background: #f6f4f8;
}
.post{
width: 80%;
min-height: 300px;
max-height: 500px;
margin: 20px auto;
box-shadow: 0 3px 5px 0 rgba(0,0,0,.05);
border-radius: 6px;
padding: 10px;
}
.title{
width: 100%;
padding: 10px 20px;
background: lightblue;
color: white;
font-size: 18px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
margin: -10px;
margin-bottom: 10px;
}
.date{
font-size: 0.75em;
color: grey;
}
.story{
}
JavaScript
vytvorPost = function() {
var post = document.createElement("div");
var title = document.createElement("h2");
var date = document.createElement("h3");
var story = document.createElement("div");
post.id = "post";
title.id = "title";
date.id = "date";
story.id = "story";
post.className = "post";
title.className = "title";
date.className = "date";
story.className = "story";
title.innerHTML = "Toto je title";
date.innerHTML = "07.10.2016";
story.innerHTML = "Cupcake ipsum dolor sit amet cake. Lollipop lollipop cheesecake jujubes gummies chocolate cake sesame snaps brownie. Liquorice I love dessert jelly-o sweet roll bear claw gummies. Bear claw tootsie roll I love sweet roll pudding muffin.";
post.appendChild(title);
post.appendChild(date);
post.appendChild(story);
document.body.appendChild(post);
}