Skip to content

Instantly share code, notes, and snippets.

@kylefelipe
Last active May 22, 2020 23:27
Show Gist options
  • Save kylefelipe/f7c41807f8d19e06ac96efea7634ae48 to your computer and use it in GitHub Desktop.
Save kylefelipe/f7c41807f8d19e06ac96efea7634ae48 to your computer and use it in GitHub Desktop.
Problemas que estou tendo ao estilizar o projeto. a borda do item meme-image-container não ajusta ao tamanho da imagem.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<link rel="stylesheet" href="style.css">
<title>Meme Generator Plus Tabajara</title>
</head>
<body>
<header class="header">
<h1 class="center">Meme Generator Plus Tabajara</h1>
<p class="center">Fazendo memes com équiu.</p>
</header>
<article class="meme-generator">
<label>Coloque seu texto aqui!:
<input id="text-input" type="text" maxlength=60>
</label>
<label for="meme-insert" id="choose-file">
<input type="file" name="file" id="meme-insert">
</label>
</article>
<section id="meme-image-container">
<p id="meme-text"></p>
<img alt="Imagem do meme!" id="meme-image">
</section>
<script src="script.js"></script>
</body>
</html>
const memeInput = document.getElementById("meme-insert");
const memeImage = document.getElementById("meme-image");
const textInput = document.getElementById("text-input");
const memeText = document.getElementById("meme-text");
memeInput.addEventListener("input", function(){
memeImage.src = URL.createObjectURL(this.files[0]);
});
textInput.addEventListener("keyup", function() {
memeText.innerText = this.value;
})
.header {
border-style: dashed;
position: relative;
height: 10em;
}
.center {
position: absolute;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
.header h1 {
top: 40%;
}
.header p {
top: 70%;
}
.meme-generator {
height: auto;
}
#meme-image-container {
margin-top: 10px;
/* display: flex; */
position: relative;
border-style: solid;
border-color: black;
border-width: 1px;
background-color: white;
height: 400px;
}
#meme-text {
font-size: 30px;
color: white;
position: absolute;
text-shadow: 5px 5px 5px black;
z-index: 2;
left: 50%;
bottom: 10px;
}
#meme-image {
z-index: 1;
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment