I'm trying to create a result page for matches, however at the moment it looks weird when the VS is not centered at all time. My question is then how can i always center the VS?
http://jsfiddle.net/3adhoker/
.result-in-month:nth-child(even) {
background-color: #ebebeb;
}
.result-in-month {
background-color: #f3f3f3;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.gdlr-result-date {
display: inline-block;
width: 20%;
margin-right: 2%;
font-style: italic;
}
.gdlr-result-match-team-wrapper {
display: inline-block;
width: 56%;
text-align: center;
font-weight: bold;
text-transform: uppercase;
}
.gdlr-result-match-versus {
margin: 0px 2.5%;
padding: 0px 3px;
font-weight: normal;
}
.gdlr-result-match-team.gdlr-left {
margin-right: 2.5%;
text-align: right;
}
.gdlr-result-match-team.gdlr-right {
margin-left: 2.5%;
text-align: left;
}
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real Soccer
</span>
</div>
<div class="clear"></div>
</div>
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real MASTERCLASS
</span>
</div>
<div class="clear"></div>
</div>
You can use display: table and display: table-cell and set a fix width(check comments in css):
.result-in-month:nth-child(even) {
background-color: #ebebeb;
}
.result-in-month {
background-color: #f3f3f3;
display: table;/*add display table*/
width: 100%;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.gdlr-result-date {
display: table-cell;/*add display to table-cell*/
width: 20%;
margin-right: 2%;
font-style: italic;
}
.gdlr-result-match-team-wrapper {
display: table;/*add display table*/
text-align: center;
font-weight: bold;
text-transform: uppercase;
}
.gdlr-result-match-versus {
display: table-cell;/*add display to table-cell*/
margin: 0px 2.5%;
padding: 0px 3px;
font-weight: normal;
}
.gdlr-result-match-team.gdlr-left {
display: table-cell;/*add display to table-cell*/
margin-right: 2.5%;
text-align: right;
}
.gdlr-result-match-team.gdlr-right {
display: table-cell;
margin-left: 2.5%;
text-align: left;
width: 200px;/*set width to a fixed value for example 200px*/
}
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real Soccer
</span>
</div>
<div class="clear"></div>
</div>
<div class="result-in-month">
<div class="gdlr-result-date">25 Sun - 14:00</div>
<div class="gdlr-result-match-team-wrapper">
<span class="gdlr-result-match-team gdlr-left">
Bristol City
</span>
<span class="gdlr-result-match-versus">
VS
</span>
<span class="gdlr-result-match-team gdlr-right">
Real MASTERCLASS
</span>
</div>
<div class="clear"></div>
</div>
Instead of using display: table-cell;, it's better to use real tables for this. For actual tabular data they are still the best solution.
.result-in-month tr:nth-child(even) {
background-color: #ebebeb;
}
.result-in-month{
border-spacing: 0px;
border-collapse: separate;
font-size: 15px;
width: 100%;
background-color: #f3f3f3;
}
.result-in-month td{
padding: 20px 30px;
}
.gdlr-result-date {
font-style: italic;
}
td.gdlr-result-match-versus {
padding: 0;
font-weight: normal;
}
.gdlr-result-match-team {
font-weight: bold;
text-transform: uppercase;
}
.gdlr-left {
text-align: right;
}
.gdlr-right {
text-align: left;
}
<table class="result-in-month">
<tr>
<td class="gdlr-result-date">25 Sun - 14:00</td>
<td class="gdlr-result-match-team gdlr-left"> Bristol City</td>
<td class="gdlr-result-match-versus">VS</td>
<td class="gdlr-result-match-team gdlr-right">Real Soccer</td>
</tr>
<tr>
<td class="gdlr-result-date">25 Sun - 14:00</td>
<td class="gdlr-result-match-team gdlr-left"> Bristol City</td>
<td class="gdlr-result-match-versus">VS</td>
<td class="gdlr-result-match-team gdlr-right">Real MASTERCLASS</td>
</tr>
</table>
JSFiddle
.result-in-month {
...
display: table-row;
}
.result-in-month > div {
display: table-cell;
padding: 10px 0;
}
.gdlr-result-match-team-wrapper > span {
display: table-cell;
padding: 0 10px;
}
Demo
My solution uses position:absolute
http://jsfiddle.net/3adhoker/4/
.result-in-month {
position: relative;
background-color: #f3f3f3;
}
.result-in-month {
padding: 20px 30px;
font-size: 15px;
}
.gdlr-result-date {
display: inline-block;
width: 20%;
margin-right: 2%;
font-style: italic;
}
.gdlr-result-match-team-wrapper {
display: inline-block;
width: 56%;
text-align: center;
font-weight: bold;
text-transform: uppercase;
position: absolute;
}
.gdlr-result-match-versus {
font-weight: normal;
position: absolute;
left: 0;
right: 0;
text-align: center;
}
.gdlr-result-match-team.gdlr-left {
text-align: right;
width: 50%;
position: absolute;
left: 0;
padding-right: 30px;
box-sizing: border-box;
}
.gdlr-result-match-team.gdlr-right {
text-align: left;
position: absolute;
padding-left: 30px;
width: 50%;
right: 0;
box-sizing: border-box;
}
Related
So I'm trying to make an easy website for a server user ordering stuffs. But now I have a problem that will affect about the Navigator text.
Now it's looks like this:
As you can see in the code below, there should be a navigator text above the Back button and also the Categories button below should be shows like the back and prices button above too since they're the same code.
I tried for some other way but it's kinda out my coding range so I decide to find on Google but I don't find any helpful solve.
Is that actually can be fix?
Conclusion: problem
"Navigator" text disappear at 100% zoom view
Category buttons can't shows like buttons above (same codes as buttons above but different ID)
.title {
color: #66d4ff;
background-color: #444444;
font-size: 62px;
text-align: center;
border: solid 10px #66d4ff;
padding: 50px;
margin-left: 302px;
}
body {
background: #444444;
}
button {
color: #66d4ff;
background: #444444;
font-size: 30px;
font-family: 'Times New Roman', Times, serif;
}
a {
color: #66d4ff
}
nav {
position: fixed;
top: 0;
left: 0;
width: 300px;
height: 100%;
background: #4a4a4a;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-right: solid 2px #ffffff;
overflow-y: scroll;
}
.nav::-webkit-scrollbar {
display: hidden;
}
main {
color: #66d4ff;
background-color: #444444;
font-size: 20px;
}
.navigator {
display: block;
margin-bottom: 50px;
color: #66d4ff;
font-size: 35px;
text-align: center;
}
.store {
padding: 0 99.5px 0 99.5px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.prices {
padding: 0 93.5px 0 93.5px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Woods {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Stones {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Brewing {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Enchanting {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Color {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Nether {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.Redstone {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
<main>
<div class="title">
<t1>MineGlobe | IchorDragon's Store</t1>
</div>
</main>
<nav>
<div id="navigator">
<p class="navigator">Navigator</p>
<div>
<button class="store">Back</button>
<button class="prices">Prices</button>
</div>
</div>
<div id="category">
<p class="navigator">Select Category</p>
<div>
<button class="Woods" onclick="document.getElementById('Woods').scrollIntoView();"><a style="text-decoration: none;">Woods</a></button>
<button class="Stones" onclick="document.getElementById('Stones').scrollIntoView();"><a style="text-decoration: none;">Stones</a></button>
<button class="ArmorsWeapon" onclick="document.getElementById('ArmorsWeapon').scrollIntoView();"><a style="text-decoration: none;">Armors & Weapons</a></button>
<button class="Brewing" onclick="document.getElementById('Brewing').scrollIntoView();"><a style="text-decoration: none;">Brewing</a></button>
<button class="Enchanting" onclick="document.getElementById('Enchanting').scrollIntoView();"><a style="text-decoration: none;">Enchanting</a></button>
<button class="Color" onclick="document.getElementById('Color').scrollIntoView();"><a style="text-decoration: none;">Color</a></button>
<button class="Redstone" onclick="document.getElementById('Redstone').scrollIntoView();"><a style="text-decoration: none;">Redstone</a></button>
<button class="Nether" onclick="document.getElementById('Nether').scrollIntoView();"><a style="text-decoration: none;">Nether</a></button>
</div>
</div>
</nav>
I honestly can't explain all the changes made, there are too many. My attempt was to clean up your code and give you a working layout (hopefully that's what you were looking for).
In 2021 there are better layouts compared to fixed menu (with grids for example), which work better in responsive and are more clean. But it would require an in-depth study that's up to you.
body {
background-color: #444444;
}
main {
width: 100%;
padding-left: 302px;
box-sizing: border-box;
overflow:hidden;
color: #66d4ff;
background-color: #444444;
font-size: 20px;
}
.title {
padding: 50px;
border: solid 10px #66d4ff;
font-size: 62px;
text-align: center;
}
nav {
position: fixed;
top: 0;
left: 0;
width: 300px;
height: 100%;
background-color: #4a4a4a;
border-right: solid 2px #ffffff;
overflow-y: scroll;
color: #66d4ff;
}
.navigator {
display: block;
margin-bottom: 50px;
font-size: 35px;
text-align: center;
}
button {
width:96%;
margin: 10px auto;
background: #444444;
color: #66d4ff;
font-size: 30px;
font-family: 'Times New Roman', Times, serif;
cursor:pointer;
}
<body>
<main>
<div class="title">
<t1>MineGlobe | IchorDragon's Store</t1>
</div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> This is a long page content...
<br/>
</main>
<nav>
<div id="navigator">
<p class="navigator">Navigator</p>
<div>
<button>Back</button>
<button>Prices</button>
</div>
</div>
<div id="category">
<p class="navigator">Select Category</p>
<div>
<button class="Woods items" onclick="document.getElementById('Woods').scrollIntoView();">Woods</button>
<button class="Stones items" onclick="document.getElementById('Stones').scrollIntoView();">Stones</button>
<button class="ArmorsWeapon items" onclick="document.getElementById('ArmorsWeapon').scrollIntoView();">Armors & Weapons</button>
<button class="Brewing items" onclick="document.getElementById('Brewing').scrollIntoView();">Brewing</button>
<button class="Enchanting items" onclick="document.getElementById('Enchanting').scrollIntoView();">Enchanting</button>
<button class="Color items" onclick="document.getElementById('Color').scrollIntoView();">Color</button>
<button class="Redstone items" onclick="document.getElementById('Redstone').scrollIntoView();">Redstone</button>
<button class="Nether items" onclick="document.getElementById('Nether').scrollIntoView();">Nether</button>
</div>
</div>
</nav>
</body>
"Navigator" text disappear: This is because justify-content: center; on the nav
Buttons will not take a width of 100% even with display: block (more information), so it needs to be added. Note that since all cathegories have the same code a single class is enough.
.title {
color: #66d4ff;
background-color: #444444;
font-size: 62px;
text-align: center;
border: solid 10px #66d4ff;
padding: 50px;
margin-left: 302px;
}
body {
background: #444444;
}
button {
color: #66d4ff;
background: #444444;
font-size: 30px;
font-family: 'Times New Roman', Times, serif;
}
a {
color: #66d4ff
}
nav {
position: fixed;
top: 0;
left: 0;
width: 300px;
height: 100%;
background: #4a4a4a;
display: flex;
flex-direction: column;
align-items: center;
/* justify-content: center; */
border-right: solid 2px #ffffff;
overflow-y: scroll;
}
.nav::-webkit-scrollbar {
display: hidden;
}
main {
color: #66d4ff;
background-color: #444444;
font-size: 20px;
}
.navigator {
display: block;
margin-bottom: 50px;
color: #66d4ff;
font-size: 35px;
text-align: center;
}
.store {
padding: 0 99.5px 0 99.5px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.prices {
padding: 0 93.5px 0 93.5px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
}
.category {
padding: 0 80px 0 80px;
display: block;
margin-top: 25px;
margin-bottom: 25px;
width: 100%;
}
<main>
<div class="title">
<t1>MineGlobe | IchorDragon's Store</t1>
</div>
</main>
<nav>
<div id="navigator">
<p class="navigator">Navigator</p>
<div>
<button class="store">Back</button>
<button class="prices">Prices</button>
</div>
</div>
<div id="category">
<p class="navigator">Select Category</p>
<div>
<button class="category Woods" onclick="document.getElementById('Woods').scrollIntoView();"><a style="text-decoration: none;">Woods</a></button>
<button class="category Stones" onclick="document.getElementById('Stones').scrollIntoView();"><a style="text-decoration: none;">Stones</a></button>
<button class="category ArmorsWeapon" onclick="document.getElementById('ArmorsWeapon').scrollIntoView();"><a style="text-decoration: none;">Armors & Weapons</a></button>
<button class="category Brewing" onclick="document.getElementById('Brewing').scrollIntoView();"><a style="text-decoration: none;">Brewing</a></button>
<button class="category Enchanting" onclick="document.getElementById('Enchanting').scrollIntoView();"><a style="text-decoration: none;">Enchanting</a></button>
<button class="category Color" onclick="document.getElementById('Color').scrollIntoView();"><a style="text-decoration: none;">Color</a></button>
<button class="category Redstone" onclick="document.getElementById('Redstone').scrollIntoView();"><a style="text-decoration: none;">Redstone</a></button>
<button class="category Nether" onclick="document.getElementById('Nether').scrollIntoView();"><a style="text-decoration: none;">Nether</a></button>
</div>
</div>
</nav>
I would like to place a vertical line between each image, I have tried several things but without success.
Here is an idea of the final result. There is a vertical gray line between the two images.
How to create the vertical line?
.background-contact{
background-color: white;
width: 100%;
height: 190px;
position: absolute;
}
.logo5{
padding-top: -70px;
padding-left: 38px;
}
.title-contact-1{
font-family: 'Questrial', sans-serif;
font-size: 22px;
margin-top: -32px;
padding-left: 20px;
position: relative;
text-transform: uppercase;
font-weight: bold;
}
.text-contact-1{
font-family: 'Questrial', sans-serif;
font-size: 14px;
top: 22%;
left: -12%;
position: relative;
transform: translateX(-50%);
}
.logo6{
padding-top: 35px;
left: -80%;
}
<div class="background-contact">
<img class="logo5" src="https://i.ibb.co/0YyTszS/title-icon1.png" >
<span class="title-contact-1">Telephone</span>
<span class="text-contact-1">Just For VIP Member</span>
<img class="logo6" src="https://i.ibb.co/026Fs1B/title-icon2.png" >
<span class="title-contact-1">E-mail Us</span>
<span class="text-contact-1">admin#superbtc.biz</span>
</div>
I didn't do the pixel perfect but something like this:
.background-contact{
background-color: white;
width: 100%;
position: absolute;
display: flex;
}
.background-contact__block {
padding-bottom: 20px;
}
.background-contact__block + .background-contact__block {
margin-left: 50px;
padding-left: 20px;
border-left: 1px solid #ccc;
}
.title-contact-1{
font-family: 'Questrial', sans-serif;
font-size: 22px;
vertical-align: middle;
text-transform: uppercase;
font-weight: bold;
display: inline-block;
}
.text-contact-1{
font-family: 'Questrial', sans-serif;
font-size: 14px;
display: block;
}
.logo{
display: inline-block;
vertical-align: middle;
}
.background-contact__name {
padding-bottom: 30px;
}
<div class="background-contact">
<div class="background-contact__block">
<div class="background-contact__name">
<img class="logo" src="https://i.ibb.co/0YyTszS/title-icon1.png" >
<span class="title-contact-1">Telephone</span>
</div>
<span class="text-contact-1">Just For VIP Member</span>
</div>
<div class="background-contact__block">
<div class="background-contact__name">
<img class="logo" src="https://i.ibb.co/026Fs1B/title-icon2.png" >
<span class="title-contact-1">E-mail Us</span>
</div>
<span class="text-contact-1">admin#superbtc.biz</span>
</div>
</div>
to create a border you can use
border: (width) (style) (color);
This will make a border all around the element, to select one side you can use
border-left:
border-right:
border-top:
border-bottom:
But here your css is very strange, I recommend you to use the less as possible absolute positioning.
Here a better way do write that :
.contact-item {
width: 200px;
display: inline-block;
}
.contact-item img,
.contact-item h1 {
display: inline-block;
}
.border-left {
border-left: 2px solid #ddd;
padding-left: 1rem;
}
<div id="background-contact">
<div class="contact-item">
<img src="https://i.ibb.co/0YyTszS/title-icon1.png">
<h1>Telephone</h1>
<p>text<p>
</div>
<div class="contact-item border-left">
<img src="https://i.ibb.co/026Fs1B/title-icon2.png">
<h1>Email Us</h1>
<p>text</p>
</div>
</div>
you can also use :
element::last-child {
border-left: .. .. ..;
}
I'm trying to achieve simple layout structure with Flexbox. I'm referring Guide to Flexbox and learning on my own. Below is my code and what I'm trying to achieve.
.order-history-items {
.order-history-table {
ul {
margin: 0;
padding: 0;
}
li {
list-style-position: inside;
list-style-type: square;
}
.order-shipped-to,
.order-items,
.order-total-price {
width: 33%;
}
.toggle {
cursor: pointer;
display: block;
}
}
}
.js .order-history-table .hidden {
display: none;
}
.orderdetails {
display: flex;
flex-wrap: wrap;
// margin: 0 1%;
h1 {
flex-basis: 100%;
}
h2 {
clear: both;
flex-basis: 100%;
text-align: center;
margin-bottom: 20px;
}
.label {
font-weight: bold;
margin-bottom: .3rem;
margin-top: .3rem;
text-transform: uppercase;
}
.order-shipment-table {
background-color: white;
border: 1px solid ;
border-radius: 5px;
padding: 1em;
}
.order-shipment-details {
.order-shipment-address {
float: right;
}
}
.line-items {
clear: both;
padding-top: 1rem;
.line-item {
padding-bottom: 1rem;
.line-item-details,
.line-item-quantity,
.line-item-price {
display: inline-block;
vertical-align: top;
}
.line-item-quantity,
.line-item-price {
width: 14%;
}
.line-item-details {
width: 70%;
a {
font-size: 1.1rem;
}
}
.line-item-quantity {
text-align: center;
}
.line-item-price {
text-align: right;
}
}
}
flex-basis: 25%;
.order-payment-summary {
#media screen and (min-width: 480px) {
float: right;
}
.label {
font-weight: 800;
font-size: 15px;
margin-bottom: 12px;
}
.order-detail-summary {
.order-key {
text-transform: uppercase;
color: #000;
letter-spacing: 0;
font-size: 12px;
}
.order-value.number--smallest {
font-size: 12px;
font-weight: bold;
letter-spacing: 0px;
color: #000;
}
.order-value.number--large {
color: #000;
letter-spacing: 0;
}
}
}
.order-information {
flex-basis: 100%;
margin-bottom: 30px;
// padding-bottom: .5em;
// padding-top: .5em;
.order-status {
span {
color: #000;
font-weight: 800;
letter-spacing: 0;
text-transform: uppercase;
font-size: smaller;
}
}
.order-date {
span {
color: #000;
font-weight: 800;
letter-spacing: 0;
text-transform: uppercase;
font-size: smaller;
}
}
.label {
color: white;
font-weight: 300;
text-transform: none;
}
.value {
font-weight: 700;
}
.order-number {
font-size: 1.75rem;
}
}
.payment-amount {
.label {
font-weight: normal;
text-transform: none;
}
}
.order-totals-table td {
&:first-child {
padding-right: 5rem;
text-align: left;
}
}
.order-payment-instruments,
.order-billing,
.order-shipment-address
{
flex-basis: 25%;
.label {
font-weight: 800;
font-size: 15px;
}
}
.order-payment-instruments{
padding-left: 84px;
}
.order-billing {
padding-left: 100px;
}
.order-shipment-address
{
padding-left: 120px;
}
.order-shipments {
h2 {
display: flex;
}
}
}
<div class="orderdetails">
<h1>My Order</h1>
<h2 class="order-number">
<span class="label">Order :</span>
<span class="value">STG00004302</span>
</h2>
<div class="order-information">
<div class="order-status">
<span class="label">Order Status:</span>
<span class="value clearfix">Complete</span>
</div>
<div class="order-date">
<span class="label">Order Placed:</span>
<span class="value">10/27/2017 11:02:15 AM</span>
</div>
</div>
<div class="order-payment-summary">
<div class="label">Payment Total</div>
<div class="order-detail-summary">
<div class="order-totals-table">
<div class="order-subtotal order-row">
<div class="order-key">Subtotal</div>
<div class="order-value number--smallest">C$ 21.33</div>
</div>
<div class="order-shipping order-row">
<div class="order-key">
Shipping
</div>
<div class="order-value number--smallest">
C$ 0.00
</div>
</div>
<div class="order-sales-tax order-row">
<div class="order-key">Taxes</div>
<div class="order-value number--smallest">
C$ 2.77
</div>
</div>
<div class="order-total order-row">
<div class="order-key">Order Total:</div>
<div class="order-value number--large">C$ 24.10</div>
</div>
</div>
</div>
</div>
<div class="order-payment-instruments">
<div class="label">
Payment Method
</div>
<div class="payment-type">PayPal</div>
<div class="payment-amount">
<span class="label">Amount:</span>
<span class="value">C$ 24.10</span>
</div>
<!-- END: payment-amount -->
</div>
<div class="order-billing">
<div class="label">Billing Address</div>
<div class="mini-address-name">
Dhon Rocafort
</div>
<div class="mini-address-location">
<address>
1120 N St
<br>Sacramento,
CA
95814-5680<br>
United States
<br>
2122121423
</address>
</div>
</div>
<div class="order-shipment-address">
<div class="label">Shipping To</div>
<div class="mini-address-name">
DihonsKi Rocafort
</div>
<div class="mini-address-location">
<address>
Air Canada Centre
<br>40 Bay St
<br>Toronto,
ON
M5J 2X2<br>
Canada
<br>
2122121423
</address>
</div>
<div class="shipping-method">
<div class="label">Method:</div>
<div class="value">StandardCA</div>
</div>
</div>
</div>
It should look like this in desktop view :
I'm caring about the main 4 columns in the end of the image, it should be responsive too. I don't have any specifics for the mobile view, but those 4 columns should be 2*2 in mobile view.
NOTE: OPEN THE SNIPPET IN FULL PAGE.
Now, first off please try to add as minimal code as possible because it's way too hard to go through this long HTML, you could remove extra tags and labels since all you need to know is how to align using flex.
I just adjusted the alignments to match the screenshot you posted. I added all the CSS properties as inline styles with style attribute on the respective tags.
Everything you need about Flexboxes will be here https://css-tricks.com/snippets/css/a-guide-to-flexbox/. Try them out and you will get a hang of it very easily.
TIP Breakdown your webpage into components and wrap them in divs. It will be much easier to control alignments with this setup particularly with flexboxes.
html, body {
height: 100%;
}
.order-history-items {
.order-history-table {
ul {
margin: 0;
padding: 0;
}
li {
list-style-position: inside;
list-style-type: square;
}
.order-shipped-to,
.order-items,
.order-total-price {
width: 33%;
}
.toggle {
cursor: pointer;
display: block;
}
}
}
.js .order-history-table .hidden {
display: none;
}
.orderdetails {
display: flex;
flex-wrap: wrap;
// margin: 0 1%;
h1 {
flex-basis: 100%;
}
h2 {
clear: both;
flex-basis: 100%;
text-align: center;
margin-bottom: 20px;
}
.label {
font-weight: bold;
margin-bottom: .3rem;
margin-top: .3rem;
text-transform: uppercase;
}
.order-shipment-table {
background-color: white;
border: 1px solid ;
border-radius: 5px;
padding: 1em;
}
.order-shipment-details {
.order-shipment-address {
float: right;
}
}
.line-items {
clear: both;
padding-top: 1rem;
.line-item {
padding-bottom: 1rem;
.line-item-details,
.line-item-quantity,
.line-item-price {
display: inline-block;
vertical-align: top;
}
.line-item-quantity,
.line-item-price {
width: 14%;
}
.line-item-details {
width: 70%;
a {
font-size: 1.1rem;
}
}
.line-item-quantity {
text-align: center;
}
.line-item-price {
text-align: right;
}
}
}
flex-basis: 25%;
.order-payment-summary {
#media screen and (min-width: 480px) {
float: right;
}
.label {
font-weight: 800;
font-size: 15px;
margin-bottom: 12px;
}
.order-detail-summary {
.order-key {
text-transform: uppercase;
color: #000;
letter-spacing: 0;
font-size: 12px;
}
.order-value.number--smallest {
font-size: 12px;
font-weight: bold;
letter-spacing: 0px;
color: #000;
}
.order-value.number--large {
color: #000;
letter-spacing: 0;
}
}
}
.order-information {
flex-basis: 100%;
margin-bottom: 30px;
// padding-bottom: .5em;
// padding-top: .5em;
.order-status {
span {
color: #000;
font-weight: 800;
letter-spacing: 0;
text-transform: uppercase;
font-size: smaller;
}
}
.order-date {
span {
color: #000;
font-weight: 800;
letter-spacing: 0;
text-transform: uppercase;
font-size: smaller;
}
}
.label {
color: white;
font-weight: 300;
text-transform: none;
}
.value {
font-weight: 700;
}
.order-number {
font-size: 1.75rem;
}
}
.payment-amount {
.label {
font-weight: normal;
text-transform: none;
}
}
.order-totals-table td {
&:first-child {
padding-right: 5rem;
text-align: left;
}
}
.order-payment-instruments,
.order-billing,
.order-shipment-address
{
flex-basis: 25%;
.label {
font-weight: 800;
font-size: 15px;
}
}
.order-payment-instruments{
padding-left: 84px;
}
.order-billing {
padding-left: 100px;
}
.order-shipment-address
{
padding-left: 120px;
}
.order-shipments {
h2 {
display: flex;
}
}
}
<div class="orderdetails" style="display: flex; flex-direction: column; height: 50%">
<h1 style="margin: auto;">My Order</h1>
<h2 class="order-number" style="margin: auto;">
<span class="label">Order :</span>
<span class="value">STG00004302</span>
</h2>
<div class="order-information" style="margin: 10px;">
<div class="order-status">
<span class="label">Order Status:</span>
<span class="value clearfix">Complete</span>
</div>
<div class="order-date">
<span class="label">Order Placed:</span>
<span class="value">10/27/2017 11:02:15 AM</span>
</div>
</div>
<div style="display: flex; flex-direction: row; justify-content: space-around;">
<div class="order-payment-summary">
<div class="label">Payment Total</div>
<div class="order-detail-summary">
<div class="order-totals-table">
<div class="order-subtotal order-row">
<div class="order-key">Subtotal</div>
<div class="order-value number--smallest">C$ 21.33</div>
</div>
<div class="order-shipping order-row">
<div class="order-key">
Shipping
</div>
<div class="order-value number--smallest">
C$ 0.00
</div>
</div>
<div class="order-sales-tax order-row">
<div class="order-key">Taxes</div>
<div class="order-value number--smallest">
C$ 2.77
</div>
</div>
<div class="order-total order-row">
<div class="order-key">Order Total:</div>
<div class="order-value number--large">C$ 24.10</div>
</div>
</div>
</div>
</div>
<div class="order-payment-instruments">
<div class="label">
Payment Method
</div>
<div class="payment-type">PayPal</div>
<div class="payment-amount">
<span class="label">Amount:</span>
<span class="value">C$ 24.10</span>
</div>
<!-- END: payment-amount -->
</div>
<div class="order-billing">
<div class="label">Billing Address</div>
<div class="mini-address-name">
Dhon Rocafort
</div>
<div class="mini-address-location">
<address>
1120 N St
<br>Sacramento,
CA
95814-5680<br>
United States
<br>
2122121423
</address>
</div>
</div>
<div class="order-shipment-address">
<div class="label">Shipping To</div>
<div class="mini-address-name">
DihonsKi Rocafort
</div>
<div class="mini-address-location">
<address>
Air Canada Centre
<br>40 Bay St
<br>Toronto,
ON
M5J 2X2<br>
Canada
<br>
2122121423
</address>
</div>
<div class="shipping-method">
<div class="label">Method:</div>
<div class="value">StandardCA</div>
</div>
</div>
</div>
</div>
CHECK THIS CODEPEN
The code is cluttered, but I have used Flexbox for your Payment total and position:absolute to your class="order-value" and right:10px
1st text part has two lines. 2nd text line has only one line. Here, I attached the image:
How do I do this using css?
<td class="right-col">
<div>
<div>
<span>average<br>cost</span>
</div>
<div>
<span>$2,500</span>
</div>
</div>
</td>
Try to this way
define class on your div and some write css according to your design.
.mainDiv{
padding: 20px;
background: #fcfcfc;}
.left-text {
display: inline-block;
vertical-align: top;
text-align: right;
color: gray;
text-transform: uppercase;
font-size: 11px;
line-height: 13px;
}
.right-text {
display: inline-block;
vertical-align: top;
text-align: right;
color: gray;
text-transform: uppercase;
font-size: 23px;
margin-left: 5px;
}
<div class="mainDiv">
<div class="left-text">
<span>average<br>cost</span>
</div>
<div class="right-text">
<span>$2,500</span>
</div>
</div>
One of the many ways you can do this.
.container {
width: 200px;
background: #E0E0E0;
font-size: 0;
font-family: sans-serif, serif;
padding: 20px;
}
.column {
color: #757575;
font-size: 16px;
display: inline-block;
width: 50%;
padding: 10px;
box-sizing: border-box;
vertical-align: middle;
}
.txt-left {
text-align: left;
font-size: 24px;
}
.txt-right {
font-size: 12px;
text-align: right;
}
<div class="container">
<div class="column txt-right">
<span>AVERAGE<br>COST</span>
</div>
<div class=" column txt-left">
<span>$2,500</span>
</div>
</div>
.right-col div {
table-layout: fixed;
font-family: Arial, sans-serif;
text-transform: uppercase;
background: linear-gradient(to bottom, #f7f8f8 0%,#fbfbfb 56%,#f5f6f6 74%,#e8e9e9 100%);
line-height: 10px;
font-size: 10px;
color: #85929c;
display: table;
width: 200px;
}
.right-col div span {
vertical-align: top;
display: table-cell;
padding: 10px 3px;
}
.right-col .text {
text-align: right;
}
.right-col .amount {
line-height: 20px;
font-size: 18px;
}
<table class="table">
<tbody>
<tr>
<td class="right-col">
<div>
<span class="text">average<br>cost</span>
<span class="amount">$2,500</span>
</div>
</td>
</tr>
</tbody>
</table>
The goal is to get the Kanji, English, and Kana rows of text lined up with each other into a specific format. Such that the text is largely interchangeable and isn't hard-coded.
The Kanji and English should be evenly placed next to each other. The Kana should be aligned with the top of the second row.
It was working before, but it was hard-coded, I commented out those regions.
It should look like this:
body {
height: 100%;
padding: 0;
margin: 0;
font-size: 60%;
font-family: Verdana,sans-serif;
word-break: break-all;
}
#header {
padding-top: 10px;
width:100%;
height:286px;
padding-top: 20px;
}
#kanjiTransl{
display: inline-block;
font-size: 5.5em;
font-weight: bold;
/*position: absolute;*/
/*left: 25px;*/
/*top:15px;*/
line-height: 1.1em;
}
#jaN {
margin-bottom: 5px;
}
#kana {
display: inline-block;
vertical-align: top;
color: #777;
/*position: inline;*/
/*right: 30px;*/
/*top:130px;*/
/*font-size: 1.4em;*/
}
.top {
letter-spacing: -0.07em;
}
.bottom {
letter-spacing: -0.02em;
/*margin-left: 12px;*/
}
.topColor {
/*color: #FF2EDF;
color: #84FF00;
color: #b4FF00;*/
color: #a78317;
color: #908090;
}
.bottomColor {
/*color: #84FF00;
color: #FF2EDF;
color: #dc3616;*/
color: #9f3420;
color: #222266;
}
.headerItem {
display: inline-block;
/*height:110px;*/
/*width:900px;*/
/*position: relative;*/
/*left:.6em;*/
/*line-height: 110px;*/
font-size:15em;
font-weight:900;
}
<body>
<div id="header">
<div id="kanjiTransl">
<span id="jaN" class="topColor">驚<br>的<br></span>
<span id="jaV" class="bottomColor">速<br>記</span>
</div>
<span class="headerItem top topColor">LARGE</span><br>
<span class="headerItem bottom bottomColor">WARNING</span>
<span id="kana">ノテイショナルヴェロシティ</span>
</div>
</body>
Use this Layout and tune it to your needs:
#header {
padding-top: 10px;
width: 100%;
height: 286px;
width: 850px;
}
#jaN,
#jaV {
font-size: 5.5em;
font-weight: bold;
line-height: 1.1em;
vertical-align: top;
color: #777;
}
#kana {
float: right;
}
.top,
.bottom {
vertical-align: top;
font-weight: 900;
}
.top {
letter-spacing: -0.07em;
color: #908090;
font-size: 15em;
line-height: 0.3em;
}
.bottom {
letter-spacing: -0.02em;
font-size: 10em;
line-height: 0.3em;
color: #222266;
}
<table id="header">
<tr>
<td id="jaN">驚
<br>的</td>
<td>
<span class="top">NATIONAL</span>
</td>
</tr>
<tr>
<td id="jaV">速
<br>記</td>
<td>
<span class="bottom">VELOCITY</span>
<span id="kana">ノテイショナルヴェロシティ</span>
</td>
</tr>
</table>