Skip to content

Commit

Permalink
added simple 'add character' btn
Browse files Browse the repository at this point in the history
  • Loading branch information
Katarni committed Aug 2, 2024
1 parent 592cc89 commit e9cc096
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ <h1 id="header-title">DnD battles</h1>
</header>

<main>

<div class="charapter-box">
<button class="add-char-btn">+</button>
</div>
</main>

<footer>

</footer>

<script src="js/main.js"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function addCharacter() {
const character = document.createElement('div');
character.classList.add("charapter-box");
document.querySelector("main").appendChild(character);
}

document.querySelector(".add-char-btn").addEventListener("click", () =>
addCharacter()
);
32 changes: 31 additions & 1 deletion styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ body {
padding: 0;
margin: 0;
border: none;
height: 100%;
}

header {
Expand All @@ -12,10 +13,39 @@ header {
}

#header-title {
color: #797593;
color: #575279;
margin-left: 30px
}

main {
background: #faf4ed;
padding: 40px 15px 40px 15px;

display: flex;
flex-direction: column;
align-items: center;
}

.charapter-box {
background: #f2e9e1;
border: 1px solid #cecacd;
border-radius: 15px;
height: 80px;
width: 80%;
text-align: center;
}

.charapter-box:not(:first-child) {
margin-top: 30px;
}

.add-char-btn {
color: #575279;
background: transparent;
width: 100%;
height: 100%;
border: none;
border-radius: 15px;
font-size: 40px;
padding: 0;
}

0 comments on commit e9cc096

Please sign in to comment.