I am new to HTML and CSS styling. I need to develop an invoice as per format giving by the client. I have created the invoice,but in most of the places I have used Position = Absolute. If I have to show one product, then it works fine. But if there are multiple products, the product's image and text start to overlap each other and the div in which I am showing the product does not expand neither the footer goes down as per div height expansion.
Here is the template that I have created
I need help to place the products in the div without overlapping each other (div height expansion) and the footer should move downwards as per the height expansion of the div.
Deadline is near and I am really stuck on this issue. Your help will be highly appreciated. Thanks
Try something like this. Note: I didn't incorporate the images that seem to be in the background. And the footer is not styled yet.
body {
margin: 0;
padding: 0.44in;
font-style: normal;
font-weight: 400;
font-size: 9pt;
font-family: Roboto;
color: #333333;
}
.invoice-container {
width: 8.41in;
height: 11.14in;
background-image: url(ci_1.png);
display: flex;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
justify-content: flex-start;
justify-items: space-around;
}
.invoice-break {
flex-basis: 100%;
}
.invoice-head {
justify-content: center;
line-height: 0.21in;
flex-basis: 100%;
display: flex;
}
.invoice-logo {
width: 0;
margin-left: .15in;
}
.invoice-title {
margin: 0 auto;
font-size: 12pt;
font-weight: 700;
color: #3c3c3c;
}
.invoice-title > div {
font-size: 9pt;
font-weight: 400;
}
.invoice-billing {
line-height: 0.18in;
flex-basis: 100%;
display: flex;
justify-items: flex-start;
margin: .3in .15in 0;
color: #000000;
}
.invoice-billing > * {
flex-grow: 1;
}
.invoice-bill-to {
font-weight: 700;
flex-basis: 2.69in;
}
.invoice-ship-to {
font-weight: 700;
flex-basis: 2.69in;
}
.invoice-detail {
flex-basis: 2.69in;
}
.invoice-order {
flex-basis: 100%;
box-sizing: border-box;
margin: 0.3in 0.15in 0;
}
.invoice-order table {
width: 100%;
}
.invoice-order th {
/* color: #ffffff; */
padding: 0.1in;
}
.invoice-order th.item-desc {
text-align: left;
}
.invoice-order th.item-qty, .invoice-order th.item-price, .invoice-order th.item-total {
text-align: right;
}
.invoice-order td {
vertical-align: center;
padding: 0.1in;
}
.invoice-order td.item-qty, .invoice-order td.item-price, .invoice-order td.item-total {
text-align: right;
}
.product {
display: flex;
}
.product-picture {
margin-right: 0.15in;
}
.product-description {
display: flex;
flex-direction: column;
justify-content: center;
}
.product-title {
font-weight: 700;
}
.invoice-notes {
margin: 0 0.15in;
padding-top: 0.075in;
}
.invoice-notes-title {
font-weight: 700;
}
.invoice-notes-copy {
margin-top: 0.15in;
}
.invoice-shipping-total {
margin-left: auto;
flex-basis: 3in;
margin-right: .15in;
}
.invoice-shipping-total table {
width: 100%;
}
.invoice-shipping-total tr:last-child {
/* color: #ffffff;*/
}
.invoice-shipping-total th {
text-align: left;
padding: .1in;
}
.invoice-shipping-total td {
text-align: right;
padding: .1in;
}
.invoice-footer {
flex-basis: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
}
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet">
<div class="invoice-container">
<div class="invoice-head">
<div class="invoice-logo"><img width="175" height="53" src="ri_1.png"></div>
<div class="invoice-title">
A4Tech Pakistan
<div>
Online Store - Pakistan<br>
www.a4tech.pk<br>
03 111 611 711
</div>
</div>
</div>
<div class="invoice-break"></div>
<div class="invoice-billing">
<div class="invoice-bill-to">
Bill to<br />
Kashif Ali<br />
Alkhidmat Foundation Pakistan<br />
3 km Khayaban e jinnah near Dream Villas<br />
Society Lahore<br />
Lahore<br />
54000<br />
Tel. +92 323 8479146
</div>
<div class="invoice-ship-to">
Ship to<br />
Kashif Ali<br />
Alkhidmat Foundation Pakistan<br />
3 km Khayaban e jinnah near Dream Villas<br />
Society Lahore<br />
Lahore<br />
54000<br />
Tel. +92 323 8479146
</div>
<div class="invoice-detail">
Invoice No. #1280<br>
<br>
Order Date 03 May, 2019<br>
Payment Cash on delivery (cod)<br>
Shipping
</div>
</div>
<div class="invoice-break"></div>
<div class="invoice-order">
<table>
<thead>
<tr>
<th class="item-desc">Item Description</th>
<th class="item-qty">Qty</th>
<th class="item-price">Price</th>
<th class="item-total">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td class="item-desc">
<div class="product">
<div class="product-picture"><img src="ri_1.png" width="122" height="105" /></div>
<div class="product-description">
<div class="product-title">H151 Stereo Headset - 1 Year Warranty</div>
<div class="product-item-number">981-000587</div>
</div>
</div>
</td>
<td class="item-qty">× 1</td>
<td class="item-price">Rs.2,399.00 </td>
<td class="item-total">Rs.2,399.00 </td>
</tr>
</tbody>
</table>
</div>
<div class="invoice-break"></div>
<div class="invoice-notes">
<div class="invoice-notes-title">Notes</div>
<div class="invoice-notes-copy">
THIS INVOICE AND PACKING MATERIAL IS MANDATORY FOR<br>
WARRANTY PURPOSE.
</div>
<div class="invoice-notes-serial">SERIAL # 1845ALA89609</div>
</div>
<div class="invoice-shipping-total">
<table>
<tr>
<th>Subtotal</th>
<td>Rs.2,399.00</td>
</tr>
<tr>
<th>Shipping</th>
<td>Rs.0.00</td>
</tr>
<tr>
<th>Total</th>
<td>Rs.2,399.00</td>
</tr>
</table>
</div>
<div class="invoice-break"></div>
<div class="invoice-footer">
<img style="width:0.23in;height:0.23in" src="ri_5.png" />
<img style="width:0.23in;height:0.23in" src="ri_6.png" />
<img style="width:0.23in;height:0.23in" src="ri_7.png" />
<div class="invoice-break"></div>
www.logitech.pk
<div class="invoice-break"></div>
<p>If you have any questions, please do get in contact.</p>
<div class="invoice-break"></div>
info#logitech.pk
<div class="invoice-break"></div>
<p>Thanks for your business!</p>
</div>
</div>
Use some css framework is faster and more convenient. Below is an example for such a quick example -> look bootstrap documentation
.container {
font-size: 12px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
<div class="container mt-5">
<div class="row">
<div class="col-4"><img src="https://fakeimg.pl/250x100/"></div>
<div class="col-8">
<ul class="list-unstyled">
<li><strong>A4Tech Pakistan</strong></li>
<li>Online Store - Pakistan</li>
<li>www.a4tech.pk</li>
<li>03 111 611 711</li>
</ul>
</div>
</div>
<div class="row my-5">
<div class="col-4">
<b>
Bill to<br>
Kashif Ali<br>
Alkhidmat Foundation Pakistan<br>
3 km Khayaban e jinnah near Dream Villas<br>
Society Lahore<br>
Lahore<br>
54000<br>
Tel. +92 323 8479146
</b>
</div>
<div class="col-4">
<b>
Ship to<br>
Kashif Ali<br>
Alkhidmat Foundation Pakistan<br>
3 km Khayaban e jinnah near Dream Villas<br>
Society Lahore<br>
Lahore<br>
54000<br>
Tel. +92 323 8479146<br>
</b>
</div>
<div class="col-4">
<b>Invoice No. #1280 Order Date 03 May, 2019 </b><br>
Payment Cash on delivery (cod) <br>
Shipping
</div>
</div>
<div class="row mb-3">
<div class="col-2"><img src="https://fakeimg.pl/130/"></div>
<div class="col-5">H151 Stereo Headset - 1 Year Warranty <br>981-000587</div>
<div class="col-1">x1</div>
<div class="col-2">Rs.2,399.00</div>
<div class="col-2">Rs.2,399.00</div>
</div>
<div class="row mb-3">
<div class="col-2"><img src="https://fakeimg.pl/130/"></div>
<div class="col-5">H151 Stereo Headset - 1 Year Warranty <br>981-000587</div>
<div class="col-1">x1</div>
<div class="col-2">Rs.2,399.00</div>
<div class="col-2">Rs.2,399.00</div>
</div>
<div class="row mb-3">
<div class="col-2"><img src="https://fakeimg.pl/130/"></div>
<div class="col-5">H151 Stereo Headset - 1 Year Warranty <br>981-000587</div>
<div class="col-1">x1</div>
<div class="col-2">Rs.2,399.00</div>
<div class="col-2">Rs.2,399.00</div>
</div>
<div class="row notes">
<div class="col-7">
<p><b>Notes</b></p>
<p>THIS INVOICE AND PACKING MATERIAL IS MANDATORY FOR <br>
WARRANTY PURPOSE. <br>
SERIAL # 1845ALA89609 </p>
</div>
<div class="col-5">
<div class="row">
<div class="col-5">Subtotal</div>
<div class="col-5 text-right">Rs.2,399.00</div>
</div>
<div class="row">
<div class="col-5">Shipping</div>
<div class="col-5 text-right">Rs.0.00</div>
</div>
</div>
</div>
<div class="row justify-content-md-center my-5">
<div class="col-6">
<div class="row justify-content-md-center">
<div class="col-2"><img src="https://fakeimg.pl/50/"></div>
<div class="col-2"><img src="https://fakeimg.pl/50/"></div>
<div class="col-2"><img src="https://fakeimg.pl/50/"></div>
</div>
</div>
</div>
<div class="row justify-content-md-center info text-center">
<p>www.logitech.pk<br>
If you have any questions, please do get in contact. <br>
info#logitech.pk <br>
<b>Thanks for your business!</b><br>
</p>
</div>
</div>
Related
I'm doing a landing page for testing flexbox technology. I ran into a problem: I can't figure out how to position a large number of elements without resorting to crutches like this:
Also without resorting to position:absolute, because there will be inaccuracies in the margins or it will take a very long time to calculate these margins.
This is what I currently have:
On the second one, I indicated how I see one of the working implementation options: organize two columns in footer and make them flex-direction: column.
Here is my markup:
<footer class="footer">
<div class="footer__logo">
<img src="icons/Logo.svg" alt="logo" class="logo__img">
<p class="logo__text"> PETWORLD </p>
</div>
<div class="footer__input">
<label for="email" class="text">Updates right to your Inbox</label>
<input type="email" placeholder="Email Address" class="text">
<input type="submit" value="Send" class="submit__text text">
</div>
<div class="footer__privacy">
<p class="privacy__text"> Text</p>
<p class="privacy__text"> Text</p>
<p class="privacy__text"> Text</p>
</div>
<div class="footer__menu">
<!-- x3 колонки текста -->
<div class="menu__text">
<p class="text">Text</p>
<p class="text">Text</p>
<p class="text">Text</p>
</div>
</div>
<div class="footer__social">
<img src="icons/Socials icons.svg" alt="" class="logo__img">
</div>
</footer>
I decided to move away from BEM a bit and divided my footer into two visual components.
What came out in the end can be viewed below:
https://codepen.io/productomar/pen/ZEvNQjG
------------------HTML---------------------
<div class="container__footer">
<footer class="footer">
<div class="first__half">
<div class="footer__logo">
<img src="icons/Logo.svg" alt="logo" class="logo__img">
<p class="logo__text"> PETWORLD </p>
</div>
<div class="footer__input">
<label for="email" class="text">Updates right to your Inbox</label>
<input type="email" placeholder="Email Address" class="placeholder__text">
<input type="submit" value="Send" class="submit__text text">
</div>
<div class="footer__privacy">
<p class="privacy__text"> © PETWORLD 2022</p>
<p class="privacy__text"> Privacy policy</p>
<p class="privacy__text"> Terms of use</p>
</div>
</div>
<div class="second__half">
<div class="footer__menu">
<div class="menu__text">
<p class="text menu__b" style="font-weight: 600;">Our story</p>
<p class="text__item text">FAQ</p>
<p class="text__item text">Contact</p>
</div>
<div class="menu__text">
<p class="text menu__b" style="font-weight: 600;">Pet care</p>
<p class="text__item text">Treatments</p>
<p class="text__item text">Health</p>
<p class="text__item text">Hygiene </p>
</div>
<div class="menu__text">
<p class="text menu__b" style="font-weight: 600;">Shop</p>
<p class="text__item text">Pet Food</p>
<p class="text__item text">Toys</p>
<p class="text__item text">Accessories</p>
</div>
</div>
<div class="footer__social">
<img src="icons/Socials icons.svg" alt="logo__social" class="logo__social">
</div>
</div>
</footer>
</div>
------------------CSS---------------------
/* Первая часть футера */
.first__half {
display: flex;
flex-direction: column;
}
.footer {
display: flex;
padding: 70px 80.5px;
}
.footer__logo {
display: flex;
align-items: center;
}
.logo__text {
font-weight: bold;
}
.footer__input {
margin-top: 75px;
}
label {
display: block;
}
input[type="email"] {
border: 1px solid #D0D0D0;
border-radius: 10px;
margin-top: 12px;
}
.placeholder__text {
padding-top: 11px;
padding-bottom: 11px;
padding-left: 20px;
padding-right: 71px;
font-size: 18px;
color: #2D2D2D;
}
.submit__text {
padding: 11px 31.5px;
background-color: #3366FF;
color: white;
border-radius: 10px;
margin-left: 20px;
}
.footer__privacy {
display: flex;
margin-top: 33px;
}
.privacy__text {
margin-right: 30px;
font-weight: 600;
}
.privacy__text:nth-child(3) {
margin-right: 0px;
}
/* Вторая часть футера */
.second__half {
margin-left: 233px;
}
.footer__menu {
display: flex;
}
.menu__text {
margin-right: 60px;
}
.text__item {
padding-top: 16px;
}
.menu__text:nth-child(3) {
margin-right: 0px;
}
.footer__social {
margin-top: 99px;
}
.logo__social {
margin-left: 237px;
}
I've been making my anime website where people can watch anime for free with subtitles (Bulgarian subtitles, since I'm from Bulgaria). Now I'm remaking it from scratch because I have been using a theme but It didn't have much functionality... Now I'm making the slider for the recently added animes but I want it to be a custom one so I'm making.... the slider controls are not in a position, so I tried with float, flex with float, etc.... Here's a picture where it should belong: click to open the image (important)
Here's the HTML:
<div class="recent-anime">
<!-- Title and Controls -->
<div class="title-controls">
<h1 class="title">Наскоро добавни</h1>
<a><i class="fas fa-angle-left"></i></a>
<a><i class="fas fa-angle-right"></i></a>
</div>
<!-- Anime cards -->
<div class="animecards">
<div class="animecard">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
<div class="animecard ml">
<img src="images/cover.png">
<div class="ani">
<p class="anititle">Anime title</p>
<p class="aniepisode">Episode</p>
</div>
</div>
</div>
</div>
And the CSS:
.title-controls {
display: flex;
flex-direction: row;
font-size: 42px;
margin-bottom: 10px;
}
.title {
font-size: 26px;
}
.animecards {
display: flex;
}
.animecard {
display: block;
float: left;
}
.animecard img {
max-height: 325px;
}
.ml {
margin-left: 15px;
}
.ani {
text-align: center;
}
There's no JS. Still on the HTML and CSS part.
NOTE: This is clean CSS!
justify-content: space-between; on title-controls class will solve the issue shown in image
.title-controls {
display: flex;
flex-direction: row;
font-size: 42px;
margin-bottom: 10px;
justify-content: space-between;
}
i have created an html section in bootstrap, which contains a container and two main rows, the code is like below:
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<style>
.addonscard {
width: 100%;
height: 181px;
padding: 2%;
border: 1px solid #efefef;
}
.addonsimage {
width: 100%;
}
.add-on-add-unit {
color: #30ac15;
border: 1px solid #30ac15;
}
.add-on-add-unit {
font-size: 14px;
line-height: 20px;
padding: 2px 12px 2px 10px;
border-radius: 10px;
display: inline-block;
}
.add-on-add-unit {
color: #30ac15;
border: 1px solid #30ac15;
}
.addonsdesc {
font-size: 13px
}
#showmore {
text-align: center;
}
.clearme {
clear: both;
margin-top: 2%;
}
</style>
<section class="addons">
<div class="container">
<div class="row">
<div class="col-md-5">
<div class="addonscard">
<div class="row">
<div class="col-md-4">
<img class="addonsimage" src="test1.jpg" />
</div>
<div class="col-md-8">
<h4>This is Heading</h4>
<p>Price</p>
+ Add
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="addonsdesc">Standard photography at best value to turn make lifetime memories from your party. Photographer will be available for maximum 3 hours. 150 - 200 soft copies will be delivered through CD within 10 working days. </p>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="addonscard">
<div class="row">
<div class="col-md-4">
<img class="addonsimage" src="test2.jpg" />
</div>
<div class="col-md-8">
<h4>This is Heading</h4>
<p>Price</p>
+ Add
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="addonsdesc">Standard photography at best value to turn make lifetime memories from your party. Photographer will be available for maximum 3 hours. 150 - 200 soft copies will be delivered through CD within 10 working days. </p>
</div>
</div>
</div>
</div>
</div>
<div class="clearme"></div>
<div class="row">
<div class="col-md-10" id="showmore">
+ Show more add-ons
</div>
</div>
</div>
now the problem is
<div class="row">
<div class="col-md-10" id="showmore">
+ Show more add-ons
</div>
</div>
this row is going above the first row in mobile view, i have tried using mobile query to adjust but still its not moving down, can anyone please tell me what could be wrong here, thanks in advance
Remove height (181px) from ".addonscard" class in CSS and try :
.addonscard {
width: 100%;
height: auto; // height is updated from 181px to auto..
padding: 2%;
border: 1px solid #efefef;}
set height for rows and set float right for them!
#media only screen and (max-width: 576px) {
.row{
height:fit-content;
float:right;
}
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<style>
.addonscard {
width: 100%;
height: 181px;
padding: 2%;
border: 1px solid #efefef;
}
.addonsimage {
width: 100%;
}
.add-on-add-unit {
color: #30ac15;
border: 1px solid #30ac15;
}
.add-on-add-unit {
font-size: 14px;
line-height: 20px;
padding: 2px 12px 2px 10px;
border-radius: 10px;
display: inline-block;
}
.add-on-add-unit {
color: #30ac15;
border: 1px solid #30ac15;
}
.addonsdesc {
font-size: 13px
}
#showmore {
text-align: center;
}
.clearme {
clear: both;
margin-top: 2%;
}
</style>
<section class="addons">
<div class="container">
<div class="row">
<div class="col-md-5">
<div class="addonscard">
<div class="row">
<div class="col-md-4">
<img class="addonsimage" src="test1.jpg" />
</div>
<div class="col-md-8">
<h4>This is Heading</h4>
<p>Price</p>
+ Add
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="addonsdesc">Standard photography at best value to turn make lifetime memories from your party. Photographer will be available for maximum 3 hours. 150 - 200 soft copies will be delivered through CD within 10 working days. </p>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="addonscard">
<div class="row">
<div class="col-md-4">
<img class="addonsimage" src="test2.jpg" />
</div>
<div class="col-md-8">
<h4>This is Heading</h4>
<p>Price</p>
+ Add
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="addonsdesc">Standard photography at best value to turn make lifetime memories from your party. Photographer will be available for maximum 3 hours. 150 - 200 soft copies will be delivered through CD within 10 working days. </p>
</div>
</div>
</div>
</div>
</div>
<div class="clearme"></div>
<div class="row">
<div class="col-md-10" id="showmore">
+ Show more add-ons
</div>
</div>
</div>
I have a html table, which shows informations about a movie.
I am trying to change this table to a div layout because of the responsiveness. With table when I reduce the window widht, the text overlaps.
this is my table:
.label{
font-weight: bold;
text-align: right;
}
.blue-box{
background-color: green
}
<div class="blue-box">
<table>
<tr>
<td class="label">Nome:</td>
<td>Del Toro</td>
<td class="label">Data de cadastro:</td>
<td>19/05/2017</td>
<td class="label">Data de atualizacao:</td>
<td>19/05/2017</td>
</tr>
<tr>
<td class="label">Categoria de produto:</td>
<td>Diverso</td>
<td class="label">Ultimo Prêmio:</td>
<td>Leão De Ouro</td>
<td class="label">Filme Indicado</td>
<td>Shape of Water</td>
</tr>
</table>
<div>
</div>
with divs I was able to do much of the transformation, but with the labels itself, I can't figure out a way to align the labels like when I use the table layout:
.label{
font-weight: bold;
float: left;
text-align: right;
display: inline;
margin-right: 5px
}
.blue-box{
background-color: aquamarine;
overflow: hidden;
}
.father{
float: left;
margin: 0px 5px 0px 5px ;
}
.content{
float: left;
display: inline;
}
<div class="blue-box">
<div class="father">
<div class="label">
Nome:
</div>
<div class="content">
Del Toro
</div>
</div>
<div class="father">
<div class="label">
Data de cadastro:
</div>
<div class="content">
19/05/2017
</div>
</div>
<div class="father">
<div class="label">
Data de atualizacao:
</div>
<div class="content">
19/05/2017
</div>
</div>
<div class="father">
<div class="label">
Categoria de produto:
</div>
<div class="content">
Diverso
</div>
</div>
<div class="father">
<div class="label">
Ultimo Prêmio:
</div>
<div class="content">
Leão de Ouro
</div>
</div>
<div class="father">
<div class="label">
Filme indicado:
</div>
<div class="content">
Shape of water
</div>
</div>
</div>
What I'm missing? There's no way to achieve this with only HTML?
First of all, if responsiveness is what you're after, you need to find the way to employ a responsive framework, Boostrap or Material UI (flexbox base) This will solve a lot of your problems at different brakpoints of the viewport without bloating your stylesheet with media queries. Second, you need to modify your HTML to allow for compartmentalization of containers. Responsiveness works best when you use compartmentalization and specificity.
Here is how I would rework your HTML and solve the alignment issue with fair amount of CSS
.row {
width: 100%;
display: inline-block;
margin: 10px auto;
background: green;
}
.col4 {
display: inline-block;
width: 33.33333333%;
margin: 1% 0 1% 0;
position: relative;
padding-right: 15px;
float: left;
padding-left: 15px;
min-height: 1px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.col4 div{
display: inline-block;
}
label{
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: 700;
}
<div class="row">
<div class="col4">
<div>
<label>Nome:</label>
<span>Del Toro</span>
</div>
<div>
<label>Categoria de produto:</label>
<span>Diverso</span>
</div>
</div>
<div class="col4">
<div>
<label>Data de cadastro:</label>
<span>19/05/2017</span>
</div>
<div>
<label>Ultimo Prêmio:</label>
<span>Leão De Ouro</span>
</div>
</div>
<div class="col4">
<div>
<label>Data de atualizacao:</label>
<span>19/05/2017</span>
</div>
<div>
<label>Filme Indicado:</label>
<span>Shape of Water</span>
</div>
</div>
</div>
See the example here in my CODEPEN (just change the values in your HTML)
Now, here is one with Bootstrap. Check out how I was able to produce the same and IT IS RESPONSIVE without making any additional media queries. Just by using the classes container, row, and col-xs-12 col-sm-4
Boostrap is very documented here
muito fácil, né!
.blue-box{
background: green;
padding: 1rem;
}
.father{
display: inline-block;
margin: .5rem;
}
.label{
font-weight: bold;
float: left;
width: 80px;
}
.content{
float: left;
width: 70px;
}
<div class="blue-box">
<div class="father">
<div class="label">
Nome:
</div>
<div class="content">
Del Toro
</div>
</div>
<div class="father">
<div class="label">
Data de cadastro:
</div>
<div class="content">
19/05/2017
</div>
</div>
<div class="father">
<div class="label">
Data de atualizacao:
</div>
<div class="content">
19/05/2017
</div>
</div>
<div class="father">
<div class="label">
Categoria de produto:
</div>
<div class="content">
Diverso
</div>
</div>
<div class="father">
<div class="label">
Ultimo Prêmio:
</div>
<div class="content">
Leão de Ouro
</div>
</div>
<div class="father">
<div class="label">
Filme indicado:
</div>
<div class="content">
Shape of water
</div>
</div>
</div>
You can achieve almost the same result as table using DIV and CSS,
<div style="display: table;">
<div style="display: table-row;">
<div style="display: table-cell;">
Gross but sometimes useful.
</div>
</div>
</div>
have a look at https://css-tricks.com/almanac/properties/d/display/
the advantage of using this is that you have some extra features like vertical-align having it set up like this.
if you want me to modify your code to something like this. give me a buzz.
I have a problem and I tried so many hours to solve this, so I wanted to ask you if you have an idea for me.
I made a Div-Table-Layout and everything ist ok now.
Now I want to make a whole row clickable with just css Style and tried the following in the first row:
<a><tr><td></td></tr></a>
When I do this, the columns aren't as wide as before I entered the a-tag.
Is there any way to do this?
<div class="divTable">
<div class="divTableBody">
<a href="#" class="divTableRow">
<div class="col-xs-2 divTableCell">21</div>
<div class="divTableCell divTableCellRight col-xs-10">Test</div>
</a>
<div class="divTableRow">
<div class="col-xs-2 divTableCell ">21</div>
<div class="divTableCell divTableCellRight col-xs-10">Test</div>
</div>
<div class="divTableRow">
<div class="col-xs-2 divTableCell ">21</div>
<div class="divTableCell divTableCellRight col-xs-10">Test</div>
</div>
</div>
</div>
https://jsfiddle.net/9b905xry/2/
Just remove the div tag and add divTableRow to anchortag...
Hope this will help you..
.divTable {
display: table;
width: calc(100% - 30px);
margin: 15px;
}
.divTableRow {
display: table-row;
}
.divTableRow:nth-of-type(odd) {
background: #e0e0e0;
}
.divTableRow:nth-of-type(even) {
background: #FFFFFF;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell,
.divTableHead {
height: 96px;
display: table-cell;
padding: 1em;
text-align: center;
vertical-align: middle;
float: none;
}
.divTableCellLeft {
text-align: center;
}
.divTableCellRight {
text-align: left;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
<div class="divTable">
<div class="divTableBody">
<a href="" class="divTableRow">
<div class="col-xs-2 divTableCell">21</div>
<div class="divTableCell divTableCellRight col-xs-10">Test</div>
</a>
<div class="divTableRow">
<div class="col-xs-2 divTableCell ">21</div>
<div class="divTableCell divTableCellRight col-xs-10">Test</div>
</div>
<div class="divTableRow">
<div class="col-xs-2 divTableCell ">21</div>
<div class="divTableCell divTableCellRight col-xs-10">Test</div>
</div>
</div>
</div>
I think you might be going about this the wrong way I'm afraid. I really think you need to just make an html table (since this looks very much like tabular data) and simply have links in the table cells.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<table class="table">
<tr>
<td>21</td>
<td>Test</td>
</tr>
<tr>
<td>21</td>
<td>Test</td>
</tr>
</table>