I'm trying to wrap my head around making a breadcrumbs navigation that will look sort of like this.
I want the circle to be centered beneath the text. I want the text to stay within the container where I place the breadscrumbs. E.g. I can't use position absolute to place them relatively to the circle, since they would potentially overflow the container I put them in.
This is where I'm currently at... https://jsfiddle.net/04pts9ey/2/
body {
background: gray;
}
.container {
max-width: 80%;
margin: auto;
background: #f6f6f6;
padding: 40px;
}
.page {
width: 100%;
height: 400px;
border: 1px solid black;
margin-top: 24px;
}
.wrapper {
display: flex;
justify-content: space-between;
}
.step {
display: flex;
flex-direction: column;
align-items: center;
}
.text {
margin-bottom: 8px;
}
.circle {
background: purple;
width: 18px;
height: 18px;
border-radius: 50%;
position: relative;
}
.step:not(:last-child) .circle:before {
content: "";
position: absolute;
left: 50%;
top: 50%;
height: 1px;
width: 100px;
right: 100px;
background: green;
}
<div class="container">
<div class="wrapper">
<span class="step">
<span class="text">Short</span>
<span class="circle"></span>
</span>
<span class="step">
<span class="text">Long title here</span>
<span class="circle"></span>
</span>
<span class="step">
<span class="text">Medium title</span>
<span class="circle"></span>
</span>
<span class="step">
<span class="text">Another title</span>
<span class="circle"></span>
</span>
</div>
<div class="page"></div>
</div>
My main issue seems to be that I can't align the circle and text together, since putting them in a div together, makes it hard for me to draw the lines between the circles.
Something like this ?
.wrapper {
display: flex;
border: 1px solid;
}
.step {
flex: 1 1 0;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
.text {
margin-bottom: 8px;
}
.circle {
background: orange;
width: 20px;
height: 20px;
border-radius: 50%;
margin-top: auto;
}
.step:not(:last-child)>.circle:before {
content: "";
position: absolute;
height: 2px;
left: 0;
right: 0;
bottom: 10px;
transform: translate(50%, 50%);
background: orange;
}
/* Styles below are not needed, Used for illustration */
.wrapper {
resize: horizontal;
overflow: auto;
}
<h3>Bottom right corner to resize for responsiveness</h3>
<div class="wrapper">
<span class="step">
<span class="text">Short</span>
<span class="circle"></span>
</span>
<span class="step">
<span class="text">Long title here</span>
<span class="circle"></span>
</span>
<span class="step">
<span class="text">Medium title</span>
<span class="circle"></span>
</span>
<span class="step">
<span class="text">Another title</span>
<span class="circle"></span>
</span>
</div>
The code is self explanatory nevertheless if you have any question please leave a comment, The only significant changes i made are:
moved the lines from being relative to .circle to .step to have more control over the width.
margin-top:auto on the .circle to ensure it's always on be bottom in case text overflows.
Made .step equal width using flex: 1 1 0; So the lines between the circle have a unified offset.
Related
Hi I'm trying to add a colored border to my 'dreams-anchor-wrap' div but can't seem to be able to use any CSS on it for some reason and I'm not sure why. Is it not possible to wrap a div around an anchor tag and then add CSS properties to it?
here's the link to my sandbox code:
https://codesandbox.io/s/unruffled-jones-0v0xj?file=/src/App.js
You just misspelled className on 'dreams-anchor-wrap' div.Correct your mistake and should work
You have to write your classes like "class" not className.
Then it will be run correctly.
* {
margin: 0;
border: 0;
padding: 0;
}
.dream-homes-container {
display: flex;
justify-content: center;
}
.dream-home-card {
margin: 0 auto;
padding: 15px;
width: 200px;
height: 100%;
}
.dream-homes-container :last-child {
padding-right: 0;
}
.dream-home-card img {
width: 100%;
height: 70%;
}
.property-info {
width: 100%;
color: black;
padding: 0 0 5px 10px;
}
.dream-home-card a {
text-decoration: none;
width: 100%;
}
.num-specs-margin {
margin-right: 10px;
}
.dream-anchor-wrap {
border:2px solid blue;
}
.dream-homes-wrap {
margin-bottom: 50px;
}
<div class="App">
<div class="dream-home-card">
<a href="#">
<div class="dream-anchor-wrap">
<img src="https://images.pexels.com/photos/2343466/pexels-photo-2343466.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" />
<div class="property-info">
<h4>Pent Suite</h4>
<div class="property-specs">
<i class="fas fa-bed"></i>
<span class="num-beds num-specs-margin">4</span>
<i class="fas fa-shower "></i>
<span class="num-baths num-specs-margin">2</span>
<i class="fas fa-car"></i>
<span class="num-cars ">2</span>
</div>
</div>
</div>
</a>
</div>
</div>
My codepen
What I want to achieve:
I want that the elements within the process-indicator parent take up the same width except the elements with class=step AND that the divs with steps name are directly under the step element.
The process-indicator stretch 100% and the connector classes should not use fixed pixel widths so I can add 5,6 or 10 steps and it scales graphically well.
What does not work:
1.) The first after-connector and last before-connector elements in yellow do not share the same size as the elements in green/black
2.) The step names in the divs should be positioned under the according step bubble and not inline with the steps and connectors.
Be aware that I do NOT want to use the before/after pseudo selectors for the step element! =>
I need to be able to later apply dynamically a complete/incomplete class with react thus I need full control about every connector.
HTML
<ul class="process-indicator">
<li class="completed">
<span class="step"></span>
<span class="after-connector"></span>
<div>step 1</div>
</li>
<li class="incompleted">
<span class="before-connector"></span>
<span class="step"></span>
<span class="after-connector"></span>
<div>step 2</div>
</li>
<li class="incompleted">
<span class="before-connector"></span>
<span class="step"></span>
<span class="after-connector"></span>
<div>step 3</div>
</li>
<li class="incompleted">
<span class="before-connector"></span>
<span class="step"></span>
<div>step 4</div>
</li>
</ul>
SCSS
$incomplete: gray;
$complete: blue;
$step-size: 40px;
$step-line-thickness: 2px;
$border-thickness: 1px;
$darken-amount: 30%;
#mixin step-style($color) {
background-color: $color;
color: $color;
border-color: darken($color, $darken-amount);
&:before,
&:after {
background-color: $color;
border-color: darken($color, $darken-amount);
}
}
.flex {
-ms-flex: 1;
-webkit-flex: 1;
-moz-flex: 1;
flex: 1;
}
.displayFlex {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.process-indicator {
background: orange;
#extend .displayFlex;
margin: 0;
padding: 0;
margin-bottom: 1em;
> li {
#extend .displayFlex;
#extend .flex;
list-style: none;
font-size: 1.2em;
position: relative;
text-overflow: ellipsis;
color: $incomplete;
}
> li .before-connector,
li .after-connector {
#extend .flex;
position: relative;
text-overflow: ellipsis;
color: $incomplete;
}
> li .step {
width: $step-size;
height: $step-size;
background-color: $incomplete;
border-radius: 40px;
}
// line connectors
> li .after-connector {
height: 3px;
top: $step-size / 2;
background-color: green;
}
> li .before-connector {
height: 3px;
top: $step-size / 2;
background-color: red;
}
> li:first-child span.after-connector,
> li:last-child span.before-connector {
background: yellow;
}
// completed state
> li.completed {
color: $complete;
.step {
#include step-style($complete);
}
}
> li.incompleted {
color: $incomplete;
.step {
#include step-style($incomplete);
}
}
}
UPDATE
I would go with a flex solution on the container and move the seperators outside so they can grow equally:
.container {
display: flex;
width: 100%;
background: orange;
}
.step {
height: 40px;
width: 40px;
border-radius: 50%;
overflow: visible;
position: relative;
background: grey;
}
.text {
font-weight:bold;
font-size:20px;
position: absolute;
top: 100%;
margin-top: 10px;
left: 0;
white-space: nowrap;
}
.step:last-child .text {
right:0;
left:auto;
}
.seperator {
flex-grow: 1;
position: relative;
}
.seperator:before {
content: '';
display: block;
height: 10px;
position: absolute;
left: 0;
right: 0;
top: 50%;
transform: translateY(-50%);
}
.yellow:before {
background: yellow;
}
.green:before {
background: green;
}
.red:before {
background: red;
}
<div class="container">
<div class="step">
<span class="text">Step 1</span>
</div>
<div class="seperator yellow"></div>
<div class="seperator red"></div>
<div class="step">
<span class="text">Step 2</span>
</div>
<div class="seperator green"></div>
<div class="seperator red"></div>
<div class="step">
<span class="text">Step 3</span>
</div>
<div class="seperator green"></div>
<div class="seperator yellow"></div>
<div class="step">
<span class="text">Step 4</span>
</div>
</div>
Please note you will need to add margin bottom to the container to prevent any content below being overlapped by the text
I want to make the same design below
But I have a problem with the floating div which is the camera icon.
It should be clickable. I put z-index so it will be on top of the image that will change. I want to make all div to be clickable.
Hope you guys can help me.
Thanks!
here's my code
<article class="RegistrationInfo__Section media">
<div class="RegistrationInfo__Section--image media-left">
<div class="field">
<span class="file-bg">
<span
class="icon is-large"
v-if="formObject.image"
>
<img v-if src="~#/assets/images/camera.png">
</span>
<img v-else src="~#/assets/images/camera.png">
</span>
<div class="file is-boxed">
<label class="file-label">
<input
class="file-input"
type="file"
name="image"
ref="input"
#change="validateAndProcessImage"
>
<span class="file-cta">
<span class="file-icon">
<img
v-if="formObject.image"
:src="`/api/files/${formObject.image}`"
>
<img v-else src="~#/assets/images/profile_off.png">
</span>
</span>
</label>
</div>
<p v-if="formErrors.imageFiles" class="help is-danger">{{ formErrors.imageFiles[0] }}</p>
</div>
</div>
</article>
Here's my SCSS file.
.RegistrationInfo {
#at-root #{&}__Section {
#at-root #{&}--image {
margin-right: 2rem;
.field {
position: relative;
.file-bg {
position: absolute;
z-index: 1;
right: -10px;
width: 50px;
height: 50px;
.icon i {
cursor: pointer;
margin: auto;
}
}
.file {
&.is-boxed {
.file-icon {
height: 128px;
width: 128px;
margin-right: 0;
}
.file-cta {
padding: 0;
border-radius: 50%;
justify-content: center;
img {
height: 128px;
width: 128px;
border-radius: 50%;
object-fit: cover;
object-position: top;
}
}
}
}
.help {
max-width: 128px;
}
}
}
The problem seems to be with the z-index you did set.
By default, all page elements have a z-index of 1 unless otherwise specified. Provided that .file-bg is your camera icon, changing the z-index to 2 would make your div clickable.
I have six <sections> that are all rows within a flexbox wrapper. Flex-direction is set to column. Each <section> (row) has 3 <spans>, one <img>, one <i> and a <time> element, which are aligned within each <section> using position relative/absolute, using distances from the edges of the <section> element. I want to make entire <section> a link so that when a user mouses over it, the background color changes.
What's the best way to do this? I had considered making the section an <a> element and displaying it as a block but am unsure if this is even possible.
<section class="conversations-history-section">
<span class="conversations-history-section-row-selected"></span>
<img class="conversations-history-section-row-image" src="assets/images/profileimg1.png" alt="img">
<span class="conversations-history-section-row-user">
<span class="conversations-history-section-row-status online"></span>
<span class="conversations-history-section-row-name active">Lucile B. Nash</span>
<span class="conversations-history-section-row-location">Vancouver, BC</span>
</span>
<time class="conversations-history-section-row-date">8:48 AM</time>
<i class="fa fa-e1-message-success conversations-history-section-row-message"> </i>
<span class="conversations-history-section-row-snippet">Hey, it was really good to see you over the weekend, I look forward to...</span>
</section>
.conversations-history-section {
position: relative;
min-height: 140px;
max-height: 140px;
width: 400px;
color: $e1-conversations-history-section-text;
font-size: 13px;
border-bottom: 1px solid $e1-body-1px-line;
}
.conversations-history-section-row-selected {
position: absolute;
display: block;
width: 5px;
height: 140px;
left: 0px;
background-color: $e1-conversations-history-section-selected;
}
.conversations-history-section-row-selected.not {
background-color: $e1-conversations-history-wrapper-bg;
}
.conversations-history-section-row-user {
display: block;
position: relative;
max-width: 50%;
top: 20px;
left: 90px;
}
.conversations-history-section-row-image {
display: block;
position: absolute;
left: 29px;
top: 20px;
border-radius: 50%;
height: 46px;
width: 46px;
}
.conversations-history-section-row-status {
position: absolute;
display: block;
top: 8px;
left: 0px;
width: 8px;
height: 8px;
border-radius: 4px;
}
.conversations-history-section-row-status.online {
background-color: $e1-conversations-history-section-status-online;
}
.conversations-history-section-row-status.offline {
background-color: $e1-conversations-history-section-status-offline;
}
.conversations-history-section-row-name {
position: absolute;
display: block;
top: 0px;
left: 16px;
color: $e1-conversations-history-section-user-name;
font-weight: bold;
font-size: 13px;
}
.conversations-history-section-row-name.active {
color: $e1-conversations-history-section-user-name-active;
}
.conversations-history-section-row-location {
position: absolute;
display: block;
top: 20px;
left: 16px;
font-size: 11px;
}
.conversations-history-section-row-date {
position: absolute;
top: 20px;
right: 24px;
}
.conversations-history-section-row-message {
display: block;
position: absolute;
right: 24px;
bottom: 24px;
color: $e1-conversations-history-section-row-message;
font-size: 16px;
}
.conversations-history-section-row-message.error {
color: $e1-conversations-history-section-row-message-error;
}
.conversations-history-section-row-snippet {
display: block;
position: absolute;
width: 350px;
left: 24px;
bottom: 24px;
}
you have to wrap the section in a and most likely make that a a block level element.
a {
/* optional */
display: block
}
a:hover {
background: red
}
.conversations-history-section {
position: relative;
min-height: 140px;
max-height: 140px;
width: 400px;
color: $e1-conversations-history-section-text;
font-size: 13px;
border-bottom: 1px solid $e1-body-1px-line;
}
.conversations-history-section-row-selected {
position: absolute;
display: block;
width: 5px;
height: 140px;
left: 0px;
background-color: $e1-conversations-history-section-selected;
}
.conversations-history-section-row-selected.not {
background-color: $e1-conversations-history-wrapper-bg;
}
<a href="#">
<section class="conversations-history-section">
<span class="conversations-history-section-row-selected"></span>
<img class="conversations-history-section-row-image" src="assets/images/profileimg1.png" alt="img">
<span class="conversations-history-section-row-user">
<span class="conversations-history-section-row-status online"></span>
<span class="conversations-history-section-row-name active">Lucile B. Nash</span>
<span class="conversations-history-section-row-location">Vancouver, BC</span>
</span>
<time class="conversations-history-section-row-date">8:48 AM</time>
<i class="fa fa-e1-message-success conversations-history-section-row-message"> </i>
<span class="conversations-history-section-row-snippet">Hey, it was really good to see you over the weekend, I look forward to...</span>
</section>
</a>
If you don't want to link the section anywhere, then you can just :hover the section instead without adding extra HTML.
section:hover {
background: red
}
.conversations-history-section {
position: relative;
min-height: 140px;
max-height: 140px;
width: 400px;
color: $e1-conversations-history-section-text;
font-size: 13px;
border-bottom: 1px solid $e1-body-1px-line;
}
.conversations-history-section-row-selected {
position: absolute;
display: block;
width: 5px;
height: 140px;
left: 0px;
background-color: $e1-conversations-history-section-selected;
}
.conversations-history-section-row-selected.not {
background-color: $e1-conversations-history-wrapper-bg;
}
<section class="conversations-history-section">
<span class="conversations-history-section-row-selected"></span>
<img class="conversations-history-section-row-image" src="assets/images/profileimg1.png" alt="img">
<span class="conversations-history-section-row-user">
<span class="conversations-history-section-row-status online"></span>
<span class="conversations-history-section-row-name active">Lucile B. Nash</span>
<span class="conversations-history-section-row-location">Vancouver, BC</span>
</span>
<time class="conversations-history-section-row-date">8:48 AM</time>
<i class="fa fa-e1-message-success conversations-history-section-row-message"> </i>
<span class="conversations-history-section-row-snippet">Hey, it was really good to see you over the weekend, I look forward to...</span>
</section>
Yes, it is a valid solution to transform your section into an <a> and make it act as a block :
.container a {
display: block;
}
Following up on Matthieu Schaeffer's answer, I've done something like this (in plain HTML rather the more general XML, but it should work the same).
a.conversations-history-section {
display: block;
background-color: green:
}
.conversations-history-section:hover {
background-color: blue:
}
When you hover over the section, the background should turn from green to blue, or whatever colors you want.
Just one warning: make your that your schema allows putting all those elements (e.g., <time>) inside your <a> element. If your XML doesn't match your schema, the browser may do strange things. I'd recommend using an XML validator (online or downloadable).
NOTE: My code does not obey the XHTML schema, e.g., block-level elements <p> and <ul> inside an <a>. It works as shown, but when I tried putting a second-level <a> inside one of the paragraphs, only part of the text had the correct background.
This is based on the "salmon book": Cascading Style Sheets from O'Reilly, page 53 (section title "Pseudo-Class Selectors", subsection "Dynamic pseudo-classes")
Here is the code I used to test this:
<html>
<head>
<title>title</title>
<style type="text/css">
a.section {
display: block;
background-color: #8f8;
text-decoration: none;
color: black;
}
.section:hover {
background-color: #88f;
}
a.section a {
text-decoration: underline;
color: red;
display: inline;
}
a.section a:visited {
display: inline;
color: silver;
}
</style>
</head>
<body>
<div class="all">
<a href="#" class="section">
<p>This is the first paragraph<br/>
And a second line.
</p>
<ul>
<li>abc</li>
<li>def</li>
<li>ghi</li>
<li>xyz</li>
</ul>
<p>This is the second paragraph
</p>
</a>
</div>
</body>
</html>
If I understand your question correctly, all you really need is this:
section:hover{background-color:wheat;}
jsFiddle Demo
section:hover{background-color:wheat;}
.conversations-history-section {
position: relative;
min-height: 140px;
max-height: 140px;
width: 400px;
color: $e1-conversations-history-section-text;
font-size: 13px;
border-bottom: 1px solid $e1-body-1px-line;
}
.conversations-history-section-row-selected {
position: absolute;
display: block;
width: 5px;
height: 140px;
left: 0px;
background-color: $e1-conversations-history-section-selected;
}
.conversations-history-section-row-selected.not {
background-color: $e1-conversations-history-wrapper-bg;
}
.conversations-history-section-row-user {
display: block;
position: relative;
max-width: 50%;
top: 20px;
left: 90px;
}
.conversations-history-section-row-image {
display: block;
position: absolute;
left: 29px;
top: 20px;
border-radius: 50%;
height: 46px;
width: 46px;
}
.conversations-history-section-row-status {
position: absolute;
display: block;
top: 8px;
left: 0px;
width: 8px;
height: 8px;
border-radius: 4px;
}
.conversations-history-section-row-status.online {
background-color: $e1-conversations-history-section-status-online;
}
.conversations-history-section-row-status.offline {
background-color: $e1-conversations-history-section-status-offline;
}
.conversations-history-section-row-name {
position: absolute;
display: block;
top: 0px;
left: 16px;
color: $e1-conversations-history-section-user-name;
font-weight: bold;
font-size: 13px;
}
.conversations-history-section-row-name.active {
color: $e1-conversations-history-section-user-name-active;
}
.conversations-history-section-row-location {
position: absolute;
display: block;
top: 20px;
left: 16px;
font-size: 11px;
}
.conversations-history-section-row-date {
position: absolute;
top: 20px;
right: 24px;
}
.conversations-history-section-row-message {
display: block;
position: absolute;
right: 24px;
bottom: 24px;
color: $e1-conversations-history-section-row-message;
font-size: 16px;
}
.conversations-history-section-row-message.error {
color: $e1-conversations-history-section-row-message-error;
}
.conversations-history-section-row-snippet {
display: block;
position: absolute;
width: 350px;
left: 24px;
bottom: 24px;
}
<section class="conversations-history-section">
<span class="conversations-history-section-row-selected"></span>
<img class="conversations-history-section-row-image" src="assets/images/profileimg1.png" alt="img">
<span class="conversations-history-section-row-user">
<span class="conversations-history-section-row-status online"></span>
<span class="conversations-history-section-row-name active">Michael Buble</span>
<span class="conversations-history-section-row-location">Vancouver, BC</span>
</span>
<time class="conversations-history-section-row-date">7:59 AM</time>
<i class="fa fa-e1-message-success conversations-history-section-row-message"> </i>
<span class="conversations-history-section-row-snippet">I really enjoyed those singing contests at the PNE every summer..</span>
</section>
<section class="conversations-history-section">
<span class="conversations-history-section-row-selected"></span>
<img class="conversations-history-section-row-image" src="assets/images/profileimg1.png" alt="img">
<span class="conversations-history-section-row-user">
<span class="conversations-history-section-row-status online"></span>
<span class="conversations-history-section-row-name active">Michael J Fox</span>
<span class="conversations-history-section-row-location">Burnaby, BC</span>
</span>
<time class="conversations-history-section-row-date">8:08 AM</time>
<i class="fa fa-e1-message-success conversations-history-section-row-message"> </i>
<span class="conversations-history-section-row-snippet">Christopher Lloyd was better on Taxi, but I sure had great times at Burnaby Central...</span>
</section>
<section class="conversations-history-section">
<span class="conversations-history-section-row-selected"></span>
<img class="conversations-history-section-row-image" src="assets/images/profileimg1.png" alt="img">
<span class="conversations-history-section-row-user">
<span class="conversations-history-section-row-status online"></span>
<span class="conversations-history-section-row-name active">Lucile B. Nash</span>
<span class="conversations-history-section-row-location">Vancouver, BC</span>
</span>
<time class="conversations-history-section-row-date">8:48 AM</time>
<i class="fa fa-e1-message-success conversations-history-section-row-message"> </i>
<span class="conversations-history-section-row-snippet">Hey, it was really good to see you over the weekend, I look forward to...</span>
</section>
How to make two elements aligned so they will be at same distance from line in center which should be in center of wrapper. Also wrapper width is not fixed and may change.
http://jsfiddle.net/x2b2ax37/2/
<div id="block">
<div id="wrapper">
<span id="div1">2222</span>
<span id="div2">2 %</span>
</div>
<div id="wrapper">
<span id="div1">11</span>
<span id="div2">100 %</span>
</div>
<div id="wrapper">
<span id="div1">21</span>
<span id="div2">0 %</span>
</div>
</div>
1 - Initial 2 - What I expect
You could achieve it like this:
(Updated with .classes instead of #IDs)
JSFiddle - DEMO
.wrapper {
position: relative;
}
.div1 {
border: 1px solid #F00;
right: 50%;
position: absolute;
}
.div2 {
border: 1px solid #000;
position: relative;
left: 50%;
display: inline-block;
}
.block {
border: 1px solid green;
width: 200px;
}
<div class="block">
<div class="wrapper">
<span class="div1">2222</span>
<span class="div2">2 %</span>
</div>
<div class="wrapper">
<span class="div1">11</span>
<span class="div2">100 %</span>
</div>
<div class="wrapper">
<span class="div1">21</span>
<span class="div2">0 %</span>
</div>
</div>
The trick as shown earlier by Mary Melody is to use a combination of absolute and relative positioning on the child span elements, .div1 and .div2.
To make sure that the top and bottom border edges line up exactly, apply display: inline-block
to the span child elements.
The trick is to keep .div2 in the flow with a 50% left margin, which provides space for .div1,
which will be absolutely positioned using right: 50%.
To control the spacing between the two span's, add a 1px right-margin to .div1 and to preserve
symmetry, use left: 1px on .div2.
.wrapper {
position: relative;
border: 1px dashed blue;
margin-bottom: 10px;
}
.div1, .div2 {
border: 1px dotted blue;
display: inline-block;
}
.div1 {
position: absolute;
right: 50%;
margin-right: 1px;
}
.div2 {
position: relative;
margin-left: 50%;
left: 1px;
}
<div class="block">
<div class="wrapper">
<span class="div1">2222</span>
<span class="div2">2 %</span>
</div>
<div class="wrapper">
<span class="div1">11</span>
<span class="div2">100 %</span>
</div>
<div class="wrapper">
<span class="div1">21</span>
<span class="div2">0 %</span>
</div>
</div>
i do not advise to use id, u can use classes because u can not repeat the same ids each time, below is the code updated and as well a live demo.
.wrapper_block{
text-align: center;
}
.wrapper_container span{
display: inline-block;
vertical-align: top;
}
.wrapper_container span span{
display: block;
}
.wrapper_left{
text-align: right;
}
.wrapper_right{
text-align: left;
}
.wrapper_left span{
border: 1px solid red;
margin-bottom: -1px;
}
.wrapper_right span{
border: 1px solid black;
margin-bottom: -1px;
}
<div class="wrapper_block">
<div class="wrapper_container">
<span class="wrapper_left">
<span>2222</span>
<span>11</span>
<span>21</span>
</span>
<span class="wrapper_right">
<span>2 %</span>
<span>100 %</span>
<span>0 %</span>
</span>
</div>
</div>
Just need to make the div1 and div2 to inline blocks and set a width for them and also text-align to the different alignments.
Simple example
#div1 {
border: 1px solid red;
display:inline-block;
width: 50px;
text-align:right;
}