0
Hello, I’m making an application and I want to create cards using html and css, I’ve been able to create the cards, but I’m not trying to position one next to the other, someone knows how I can do it?
The layout is getting like this, but I want when the space runs out the next card goes down. CSS of cards:
@font-face{
font-family: 'IndieFlower';
src: url("../fontes/IndieFlower.ttf");
}
*{
padding: 0;
margin: 0;
border: 0;
}
.w3-card-4{
width: 400px;
float: right;
top: 10px;
left: 330px;
position: absolute;
background-color: #FFFFFF;
}
header{
background-color: #FF6861;
color: #FFFFFF;
}
footer{
background-color: #FFFFFF;
border-top: 1px solid #FF6861;
height: 55px;
text-align: right;
}
.w3-container p{
font-family: 'IndieFlower';
}
.acoes{
border: none;
display: inline-block;
}
Card code
<?php
require_once dirname(__FILE__) . '/../classes/Tarefa.php';
$tarefas = TarefaDAO::listarTarefas($usuario->getId());
if($tarefas != null):
foreach ($tarefas as $tarefa):
?>
<div class="w3-card-4">
<header class="w3-container">
<h1><?php echo $tarefa->getNome();?></h1>
</header>
<div class="w3-container">
<p>
<?php echo $tarefa->getDescricao();?>
</p>
</div>
<footer>
<form>
<input class="acoes" type="image" src="imagens/favoritar.png"/>
<input class="acoes" type="image" src="imagens/lixeira.png"/>
<input class="acoes" type="image" src="imagens/atualizar.png"/>
</form>
</footer>
<?php endforeach;?>
<?php endif?>
</div>
Main screen code
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/inicio.css"/>
<link rel="stylesheet" href="css/modal.css"/>
<link rel="stylesheet" href="css/w3.css"/>
<link rel="stylesheet" href="css/cards.css"/>
<script src='js/jquery-3.2.1.min.js' type='text/javascript'></script>
<script src='js/modal.js' type='text/javascript'></script>
<script src='js/background.js' type='text/javascript'></script>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="shortcut icon" href="imagens/todoIcone.ico"/>
<title>TODO List | Inicio</title>
<?php
require_once dirname(__FILE__) . '/includes/sessaoDeUsuario.php';
require_once dirname(__FILE__) .'/dao/TarefaDAO.php';
loginObrigatorio();
?>
<?php
$caminhoImagem = "";
if($usuario->getFotoPerfil() != null){
$caminhoImagem = $usuario->getFotoPerfil();
}else{
$caminhoImagem = "imagens/iconSemFoto.gif";
}
?>
</head>
<body>
<nav>
<ul>
<li>
<img id="fotoUsuario" src="<?php echo $caminhoImagem;?>"/>
<p class="informacoes"><?php echo $usuario->getNome();?></p>
<p class="informacoes"><?php echo $usuario->getEmail();?></p>
</li>
<li>
<p>_____________________________</p>
</li>
<li>
<a href="#addTarefa" rel="modal">Nova Tarefa</a>
</li>
<li>
<a href="">Atualizar Tarefa</a>
</li>
<li>
<a href="#atualizarPerfil" rel="modal">Atualizar Perfil</a>
</li>
<li>
<a href="">Favoritas</a>
</li>
<!--WARNING: Gambiarra abaixo-->
<li>
<p>___________</p>
</li>
<li>
<a href="funcoes/logoutUsuario.php"><img src="imagens/logout.png"/></a>
</li>
</ul>
</nav>
<div id="fundo">
<img src="imagens/fundo_principal.jpg "/>
</div>
<?php include './includes/cardsTarefas.php';?>
<?php include './includes/modalAddTarefa.php';?>
<?php include './includes/modalAtualizarPerfil.php';?>
<div id="mascara"></div>
</body>
</html>
With position Absolute you will not be able to do this.
– Sam