I'm trying to implement a Likert scale UI. I want to have the green line go behind the radio buttons. I tried changing the z-index but no luck...
#container {
text-align: justify;
background-color: #ff5050;
position: relative;
}
.line {
width: 100%;
height: 2px;
background-color: green;
position: absolute;
top: 5px;
z-index: 0;
}
input[type=radio] {
display: block;
margin: auto;
z-index: 1;
}
.box {
width: 60px;
vertical-align: top;
display: inline-block;
text-align: center;
}
.stretch {
width: 100%;
display: inline-block;
}
<div id="container">
<div class="box">
<input type="radio" name="radio"/>
<label>A</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>B</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>C</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>D</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>E</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>F</label>
</div>
<div class="line"></div>
<span class="stretch"></span>
</div>
z-index will only work along with position.
Adding position to your input[type=radio] will meet your requirement.
#container {
text-align: justify;
background-color: #ff5050;
position: relative;
}
.line {
width: 100%;
height: 2px;
background-color: green;
position: absolute;
top: 5px;
z-index: 0;
}
input[type=radio] {
position:relative;
display: block;
margin: auto;
z-index: 1;
}
.box {
width: 60px;
vertical-align: top;
display: inline-block;
text-align: center;
}
.stretch {
width: 100%;
display: inline-block;
}
<div id="container">
<div class="box">
<input type="radio" name="radio"/>
<label>A</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>B</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>C</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>D</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>E</label>
</div>
<div class="box">
<input type="radio" name="radio"/>
<label>F</label>
</div>
<div class="line"></div>
<span class="stretch"></span>
</div>
Note that z-index will only apply to elements that have a position. As such, your input elements have no z-index applied to them, and resort to the default value of 0.
It gets a little complicated with hierarchy, and .box is a sibling of .line. As such, all of your .box elements are of equal z-index to your line.
To have the line behind the notes, you'll want to use a value of -1 for .line. Note that this will actually place the .line behind container, because that also defaults to 0. As such, you'll additionally want to set a value of -1 on #container.
Ultimately, you just need to ensure four things:
That .line has a z-index equal to or greater than #container
That .box has a higher z-index than .line
That input has a z-index equal to or greater than .box
That all elements with z-index also have a position
This can be seen in the following, which only sets a -1 z-index on #container and .line:
#container {
text-align: justify;
background-color: #ff5050;
position: relative;
z-index: -1;
}
.line {
width: 100%;
height: 2px;
background-color: green;
position: absolute;
top: 5px;
z-index: -1;
}
input[type=radio] {
display: block;
margin: auto;
}
.box {
width: 60px;
vertical-align: top;
display: inline-block;
text-align: center;
}
.stretch {
width: 100%;
display: inline-block;
}
<div id="container">
<div class="box">
<input type="radio" name="radio" />
<label>A</label>
</div>
<div class="box">
<input type="radio" name="radio" />
<label>B</label>
</div>
<div class="box">
<input type="radio" name="radio" />
<label>C</label>
</div>
<div class="box">
<input type="radio" name="radio" />
<label>D</label>
</div>
<div class="box">
<input type="radio" name="radio" />
<label>E</label>
</div>
<div class="box">
<input type="radio" name="radio" />
<label>F</label>
</div>
<div class="line"></div>
<span class="stretch"></span>
</div>
Hope this helps! :)
Related
I have created both a select-box and a searchbar in html. Now I want to place both elements next to each other. I thought this would be possible by placing both elements into another div-container with display set to inline. But this doesn't really solve the issue.
.select-search-container {
display: inline;
}
.select-box {
display: flex;
flex-direction: column;
width: 400px;
}
.search-bar {
max-width: 400px;
border: none;
position: relative;
box-sizing: border-box;
left: calc(98% - 400px);
top: 20px;
}
#searchBarInput {
background: transparent;
padding: 12px 24px;
border-radius: 8px;
border: 2px solid black;
width: 100%;
box-sizing: border-box;
}
.search-bar__icon {
position: absolute;
height: 100%;
left: 90%;
top: 25%;
}
<div class="select-search-container">
<div class="select-box">
<div class="options-container">
<div class="option">
<input type="radio" class="radio" name="category" id="apples">
<label for="apples">apples</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="bananas">
<label for="bananas">bananas</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="lemons">
<label for="lemons">lemons</label>
</div>
</div>
<div class="selected">
Pick a fruit
</div>
</div>
<div class="search-bar" id="searchBar">
<input type="text" placeholder="Search Fruit" id="searchBarInput">
<i class="material-icons search-bar__icon">search</i>
</div>
</div>
As you can see, I have created the select-box using radio-buttons. I like the styling of this better than a normal select-box. Basically, I am showing the selected-div all the time and upon clicking on this div, I show the options-container. The display of the select-box is set to flex, with flex-direction column, as I want the options-container to be placed below the selected-div:
I am trying to place the searchbar next to the select-box. For this purpose I am also playing around with the left-, top- etc. specifiers. It doesn't really work though. When changing the display-type of the wrapper from inline to inline-flex, it kind of works, but the size of my searchbar shrinks and the icon isn't placed where I want it to be. I know this is a very specific question. I am very surprised that it doesn't work though and would really appreciate an explanation.
.select-search-container {
display: flex;
justify-content: space-between;
}
.select-box {
}
.search-bar {
max-width: 400px;
border: none;
position: relative;
box-sizing: border-box;
top: 20px;
}
#searchBarInput {
background: transparent;
padding: 12px 24px;
border-radius: 8px;
border: 2px solid black;
width: 100%;
box-sizing: border-box;
}
.search-bar__icon {
position: absolute;
height: 100%;
left: 90%;
top: 25%;
}
<div class="select-search-container">
<div class="select-box">
<div class="options-container">
<div class="option">
<input type="radio" class="radio" name="category" id="apples">
<label for="apples">apples</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="bananas">
<label for="bananas">bananas</label>
</div>
<div class="option">
<input type="radio" class="radio" name="category" id="lemons">
<label for="lemons">lemons</label>
</div>
</div>
<div class="selected">
Pick a fruit
</div>
</div>
<div class="search-bar" id="searchBar">
<input type="text" placeholder="Search Fruit" id="searchBarInput">
<i class="material-icons search-bar__icon">search</i>
</div>
</div>
I intend to have a long input form centered. AFTER THAT I need to place a submit button 15px after the form's right end. Could you please help me to code it? Thank you.
Note: I want to have only the form centered and after that add a button.
My attempt:
<div style="background-color: red; width: 100%; ">
<form action="file.php">
<center><input type="text" name="c2" style="width: 79%; font-size:25pt;"></center>
<input type="submit" value="send" style="position: relative; left: 15px">
</form>
</div>
Adding a photo:
Flexbox would be one of several possibilities.
.wrapper {
display:flex;
align-items: center;
justify-content: center;
}
.inp {
width: 79%;
font-size:25pt;
}
<div style="background-color: red; width: 100%; ">
<form action="file.php">
<div class="wrapper">
<input type="text" name="c2" class="inp">
<br/>
<input type="submit" value="send" style="position: relative; left: 15px">
</div>
</form>
</div>
UPDATED (again)
.main { display: flex; }
.a, .b, .c { background: red; }
.b { flex: 1; text-align: center; }
.c {margin-left: auto;}
.inp {
width: 79%;
font-size:25pt;
}
.sub {
position: relative;
right: 15px;
top:10px;
}
<div class="main">
<div class="a"></div>
<div class="b">
<form action="file.php">
<div class="wrapper">
<input type="text" name="c2" class="inp">
</div>
</form>
</div>
<div class="c">
<input type="submit" value="send" class="sub">
</div>
</div>
UPDATE (2)
.wrapper {
display:flex;
align-items: center;
justify-content: center;
}
.inp {
width: 79%;
font-size:25pt;
position: relative; left: 15px
}
.sub {
position: relative; left: 30px
}
<div style="background-color: red; width: 100%; ">
<form action="file.php">
<div class="wrapper">
<input type="text" name="c2" class="inp">
<br/>
<input type="submit" value="send" class="sub">
</div>
</form>
</div>
You can do something like this, using flexbox.
https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox
.form-container {
background-color: red;
width: 100%;
display:flex;
flex-flow: row nowrap;
justify-content:center;
padding: 10px 0;
}
<form action="file.php">
<div class="form-container">
<input type="text" name="c2" style="width: 79%; font-size:25pt;">
<input type="submit" value="send" style="position: relative; left: 15px">
</div>
</form>
I am trying to design a vertical stepper with content in the right side. However, I am having a problem. The problem is the distance between the steps are not constant when i have the content. Because the steps distance are taken based on the height of content. How can i overcome this issue and make the distance between each step constant no matter how the long the content is ?
Here is what i have done for now
.container {
width: 100%;
background: #fff;
}
.step {
padding: 50px 10px;
display: flex;
flex-direction: row;
justify-content: flex-start;
}
.v-stepper {
position: relative;
}
.step .circle {
background-color: #dedede;
border-radius: 100%;
width: 24px;
height: 24px;
display: inline-block;
}
.step .line {
top: 24px;
left: 12px;
height: 100%;
position: absolute;
border-left: 1px solid #dedede;
}
.step.completed .circle {
visibility: visible;
background-color: rgb(6, 150, 215);
border-color: rgb(6, 150, 215);
}
.step.completed .label {
color: rgb(6, 150, 215);
}
.step.active .circle {
visibility: visible;
border-color: rgb(6, 150, 215);
}
.step.empty .circle {
visibility: hidden;
}
.step.empty .line {
top: 0;
height: 150%;
}
.step:last-child .line {
display: none;
}
.label {
margin-left: 20px;
display: inline-block;
}
.headline {
background: #dedede;
padding: 5px;
}
<div class="container">
<div class="step completed">
<div class="v-stepper">
<div class="circle"></div>
<div class="line"></div>
</div>
<div class="label">
Personal
</div>
<div class="content">
<h3>Personal</h3>
<p>Description on the topic personal</p>
<h3 class="headline">Information</h3>
<form>
<input type="text" id="first_name" />
<input type="text" id="last_name" />
<input type="text" id="Phone Number" />
<input type="text" id="email" />
<input type="text" id="address" />
<input type="text" id="country" />
<input type="text" id="city" />
</form>
</div>
</div>
<div class="step">
<div class="v-stepper">
<div class="circle"></div>
<div class="line"></div>
</div>
<div class="label">
Education
</div>
</div>
<div class="step">
<div class="v-stepper">
<div class="circle"></div>
<div class="line"></div>
</div>
<div class="label">
Background
</div>
</div>
</div>
UPDATE
I mean the following way
the stepper should have constant height(the distance from one circle to another) no matter how long it's respective content has. Because I will only be showing the content of selected step.
As the second comment by godfather suggested, to make circles connected to each other remove the padding top and bottom from .step and to keep the content of each step has its own padding just add padding to .step .content.
Here's a working snippet
.container {
width: 100%;
background: #fff;
}
.step {
/* Remove the padding from top and bottom*/
/*padding: 50px 10px;*/
padding: 0 10px;
display: flex;
flex-direction: row;
justify-content: flex-start;
position: relative;
}
/* Add this to make the content of each step has its own padding */
.step .content{
padding: 20px 0 50px;
}
.v-stepper {
position: relative;
}
.step .circle {
background-color: #dedede;
border-radius: 100%;
width: 24px;
height: 24px;
display: inline-block;
}
.step .line {
top: 24px;
left: 12px;
height: 100%;
position: absolute;
border-left: 1px solid #dedede;
}
.step.completed .circle {
visibility: visible;
background-color: rgb(6, 150, 215);
border-color: rgb(6, 150, 215);
}
.step.completed .label {
color: rgb(6, 150, 215);
}
.step.active .circle {
visibility: visible;
border-color: rgb(6, 150, 215);
}
.step.empty .circle {
visibility: hidden;
}
.step.empty .line {
top: 0;
height: 150%;
}
.step:last-child .line {
display: none;
}
.label {
margin-left: 20px;
display: inline-block;
}
.headline {
background: #dedede;
padding: 5px;
}
<div class="container">
<div class="step completed">
<div class="v-stepper">
<div class="circle"></div>
<div class="line"></div>
</div>
<div class="label">
Personal
</div>
<div class="content">
<h3>Personal</h3>
<p>Description on the topic personal</p>
<h3 class="headline">Information</h3>
<form>
<input type="text" id="first_name" />
<input type="text" id="last_name" />
<input type="text" id="Phone Number" />
<input type="text" id="email" />
<input type="text" id="address" />
<input type="text" id="country" />
<input type="text" id="city" />
</form>
</div>
</div>
<div class="step">
<div class="v-stepper">
<div class="circle"></div>
<div class="line"></div>
</div>
<div class="label">
Education
</div>
<div class="content">
<h3>Personal</h3>
<p>Description on the topic personal</p>
<h3 class="headline">Information</h3>
<form>
<input type="text" id="first_name" />
<input type="text" id="last_name" />
<input type="text" id="Phone Number" />
<input type="text" id="email" />
<input type="text" id="address" />
<input type="text" id="country" />
<input type="text" id="city" />
</form>
</div>
</div>
<div class="step">
<div class="v-stepper">
<div class="circle"></div>
<div class="line"></div>
</div>
<div class="label">
Background
</div>
</div>
</div>
I have a sidebar with Facett-Checkboxes.
The width of the sidebar can change and is not under my control.
I want to have a checkbox, a description and the result count in one line for saving space.
The the count should be right aligned inside sidebar, the checkbox left. The description should take the remaining space with overflow: ellipsis for accessibility.
The solution is preferred with css only. If not possible also js could be used.
For exemple code see https://jsfiddle.net/z9d8qjsb/7/
html
<div class="sidebar_a">
<div class="row">
<input id="ckb" type="checkbox" />
<label for="ckb">
<span class="text">Description that can be verry long and should use ellipsis</span>
<span class="count">(xxxx)</span>
</label>
</div>
<div class="row">
<input id="ckb" type="checkbox" />
<label for="ckb">
<span class="text">Short Desc.</span>
<span class="count">(xxxx)</span>
</label>
</div>
</div>
<div class="sidebar_b">
<div class="row">
<input id="ckb" type="checkbox" />
<label for="ckb">
<span class="text">Description that can be verry long and should use ellipsis</span>
<span class="count">(xxxx)</span>
</label>
</div>
<div class="row">
<input id="ckb" type="checkbox" />
<label for="ckb">
<span class="text">Short Desc.</span>
<span class="count">(xxxx)</span>
</label>
</div>
</div>
css
.sidebar_a {
width: 500px;
}
.sidebar_b {
width: 100px;
}
.sidebar_a, .sidebar_b {
border: 2px solid black; /*only for illustration*/
}
.row {
position: relative;
}
.text {
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
width: 70%;
white-space: nowrap;
display: inline-block;
vertical-align: middle;
}
.count {
position: absolute;
}
UPDATE: html updated for better explanation.
.sidebar {
// width: 200px;
border;
2px solid black;
position: relative;
}
.row {
position: relative;
}
.text {
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
white-space: nowrap;
width: 200px;
display: inline-block;
vertical-align: middle;
position: relative;
}
.count {
right: 5px;
position: absolute;
}
#ckb {
float: left;
width: auto;
margin-top:6px;
}
label {
float: left;
width: auto;
position: relative;
width: 300px;
}
<div class="sidebar">
<div class="row">
<input id="ckb" type="checkbox" />
<label for="ckb">
<span class="text">Description that can be verry long and should use ellipsis</span>
<span class="count">(xxxx)</span>
</label>
</div>
</div>
You can do like this
.count {
right: -5px;
position: absolute;
}
I change the right properties in minus i think its work for you
I have a carousel created with only CSS, but I have identified some difficulties. All images are in the 4:3 aspect ratio and may have a maximum of 640x480 px (that is, they can be smaller than this value), so:
I can not center the next and previous arrows;
The arrows can not be "floating" on the screen (if the next image is
smaller than the previous one, the arrows should not change
position);
I do not know how to set the size of the carousel according to the
largest image currently used.
The code:
html {
font-size: 10px;
}
body {
padding: 2rem;
background: #F8F8F8;
font-size: 16px;
}
.wrap {
max-width: 70rem;
margin: auto;
padding: 2rem;
background: #FFF;
}
.carousel {
position: relative;
display: -webkit-box;
display: flex;
max-width: 64rem;
min-height: 40rem;
margin: auto;
background: red;
-webkit-box-pack: center;
justify-content: center;
}
.group {
display: -webkit-box;
display: flex;
background: blue;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
}
.group input {
position: absolute;
top: -100%;
left: -100%;
display: none;
}
.group input ~ .content {
/* tentar fixar tamanho aqui */
display: none;
-webkit-box-ordinal-group: 3;
order: 2;
}
div.group input:checked ~ div.content {
display: block;
}
div.group input:checked ~ label.previous,
div.group input:checked ~ label.next {
display: block;
}
div.group label {
top: 50%;
display: none;
width: 50px;
height: 50px;
border: solid 1px black;
background-color: #69C;
transform: translateY(-50%);
}
img {
width: 100%;
height: 100%;
}
label {
margin: 125px 0 0 0;
font-size: 4em;
}
label.previous {
padding: 0 0 30px 5px;
-webkit-box-ordinal-group: 2;
order: 1;
}
label.next {
padding: 0 5px 25px 0;
text-align: right;
-webkit-box-ordinal-group: 4;
order: 3;
}
<!DOCTYPE html>
<html>
<head>
<title>Teste 3</title>
<link rel="stylesheet" type="text/css" href="teste3.css">
<meta charset="utf-8">
</head>
<body>
<div class="wrap">
<div class="carousel">
<div class="group">
<input type="radio" name="test" id="0" value="0">
<label for="4" class="previous"><</label>
<label for="1" class="next">></label>
<div class="content">
<img src="https://www.oneperiodic.com/products/photobatch/tutorials/img/scale_original.png" width="200" height="286">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="1" value="1">
<label for="0" class="previous"><</label>
<label for="2" class="next">></label>
<div class="content">
<img src="https://www.ausmedia.com.au/Mmedia/4TO3.gif" width="200" height="139">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="2" value="2">
<label for="1" class="previous"><</label>
<label for="3" class="next">></label>
<div class="content">
<img src="http://www.cegepsherbrooke.qc.ca/~cpi/images/photo_4-3.jpg" width="140" height="200">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="3" value="3" checked="">
<label for="2" class="previous"><</label>
<label for="4" class="next">></label>
<div class="content">
<img src="http://www.projectorcentral.com/images/articles/4-3%20Bristlecone%20Pines.jpg" width="200" height="287">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="4" value="4">
<label for="3" class="previous"><</label>
<label for="0" class="next">></label>
<div class="content">
<img src="http://www.wallpaperawesome.com/wallpapers-awesome/wallpapers-for-monitor-4-3-almost-square-awesome/wallpaper-for-monitor-4-3-almost-square-awesome-951.jpg" width="96" height="139">
</div>
</div>
</div>
</div>
</body>
</html>
Can anyone help me find a solution or at least a balance in the measurements?
From what I understood,
You did not add
position: absolute to labels.
changed top to 18% to have them in center.
prev with left:0;
next with right:0;
This will set your labels as per the carousel, as it has the position relative.
html{
font-size: 10px;
}
body {
padding: 2rem;
background: #F8F8F8;
font-size: 16px;
}
.wrap {
max-width: 70rem;
margin: auto;
padding: 2rem;
background: #FFF;
}
.carousel {
position: relative;
display: -webkit-box;
display: flex;
max-width: 64rem;
min-height: 40rem;
margin: auto;
background: red;
-webkit-box-pack: center;
justify-content: center;
}
.group {
display: -webkit-box;
display: flex;
background: blue;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
}
.group input {
position: absolute;
top: -100%;
left: -100%;
display: none;
}
.group input ~ .content {
/* tentar fixar tamanho aqui */
display: none;
-webkit-box-ordinal-group: 3;
order: 2;
}
div.group input:checked ~ div.content {
display: block;
}
div.group input:checked ~ label.previous,
div.group input:checked ~ label.next {
display: block;
}
div.group label {
position:absolute;
top: 18%;
display: none;
width: 50px;
height: 50px;
border: solid 1px black;
background-color: #69C;
transform: translateY(-50%);
}
img {
width: 100%;
height: 100%;
}
label {
margin: 125px 0 0 0;
font-size: 4em;
}
label.previous {
padding: 0 0 30px 5px;
-webkit-box-ordinal-group: 2;
order: 1;
left:0;
}
label.next {
padding: 0 5px 25px 0;
text-align: right;
-webkit-box-ordinal-group: 4;
order: 3;
right:0;
}
<!DOCTYPE html>
<html>
<head>
<title>Teste 3</title>
<link rel="stylesheet" type="text/css" href="teste3.css">
<meta charset="utf-8">
</head>
<body>
<div class="wrap">
<div class="carousel">
<div class="group">
<input type="radio" name="test" id="0" value="0">
<label for="4" class="previous"><</label>
<label for="1" class="next">></label>
<div class="content">
<img src="https://www.oneperiodic.com/products/photobatch/tutorials/img/scale_original.png" width="200" height="286">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="1" value="1">
<label for="0" class="previous"><</label>
<label for="2" class="next">></label>
<div class="content">
<img src="https://www.ausmedia.com.au/Mmedia/4TO3.gif" width="200" height="139">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="2" value="2">
<label for="1" class="previous"><</label>
<label for="3" class="next">></label>
<div class="content">
<img src="http://www.cegepsherbrooke.qc.ca/~cpi/images/photo_4-3.jpg" width="140" height="200">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="3" value="3" checked="">
<label for="2" class="previous"><</label>
<label for="4" class="next">></label>
<div class="content">
<img src="http://www.projectorcentral.com/images/articles/4-3%20Bristlecone%20Pines.jpg" width="200" height="287">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="4" value="4">
<label for="3" class="previous"><</label>
<label for="0" class="next">></label>
<div class="content">
<img src="http://www.wallpaperawesome.com/wallpapers-awesome/wallpapers-for-monitor-4-3-almost-square-awesome/wallpaper-for-monitor-4-3-almost-square-awesome-951.jpg" width="96" height="139">
</div>
</div>
</div>
</div>
</body>
</html>
Couple issues with your code Bianca. First off when we write HTML, it's best to leave out width and height properties within the actual html. The reason for this is that the browser will consider anything in your html as more important than external css files. We call this inline-styling or inline-styles when CSS is written directly into HTML. (Here's a good explanation of the hierarchy of CSS: Inline <style> tags vs. inline css properties )
Secondly, I updated your code, and included a max-width property to the content div, wherein your images are wrapped (the controlling css). So you can set that max-width to whatever you need, and it happens to work in this case.
Here's a Codepen: http://codepen.io/0rfila/pen/JbKrwj
And your updated code:
CSS:
html {
font-size: 10px;
}
body {
padding: 2rem;
background: #F8F8F8;
font-size: 16px;
}
.wrap {
max-width: 70rem;
margin: auto;
padding: 2rem;
background: #FFF;
}
.carousel {
position: relative;
display: -webkit-box;
display: flex;
max-width: 64rem;
min-height: 40rem;
margin: auto;
background: red;
-webkit-box-pack: center;
justify-content: center;
}
.group {
display: -webkit-box;
display: flex;
position: relative;
background: blue;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
}
.group input {
position: absolute;
top: -100%;
left: -100%;
display: none;
}
.group input ~ .content {
/* tentar fixar tamanho aqui */
display: none;
-webkit-box-ordinal-group: 3;
order: 2;
}
div.group input:checked ~ div.content {
display: block;
}
div.group input:checked ~ label.previous,
div.group input:checked ~ label.next {
display: block;
}
div.group label {
top: 50%;
display: none;
width: 50px;
height: 50px;
border: solid 1px black;
background-color: #69C;
transform: translateY(-50%);
}
img {
width: 100%;
height: 100%;
}
label {
margin: 125px 0 0 0;
font-size: 4em;
}
label.previous {
padding: 0 0 30px 5px;
-webkit-box-ordinal-group: 2;
order: 1;
}
label.next {
padding: 0 5px 25px 0;
text-align: right;
-webkit-box-ordinal-group: 4;
order: 3;
}
.content {
max-width: 400px;
}
HTML:
<!DOCTYPE html>
<head>
<title>Teste 3</title>
<link rel="stylesheet" type="text/css" href="teste3.css">
<meta charset="utf-8">
</head>
<body>
<div class="wrap">
<div class="carousel">
<div class="group">
<input type="radio" name="test" id="0" value="0">
<label for="4" class="previous"><</label>
<label for="1" class="next">></label>
<div class="content">
<img src="https://www.oneperiodic.com/products/photobatch/tutorials/img/scale_original.png">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="1" value="1">
<label for="0" class="previous"><</label>
<label for="2" class="next">></label>
<div class="content">
<img src="https://www.ausmedia.com.au/Mmedia/4TO3.gif">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="2" value="2">
<label for="1" class="previous"><</label>
<label for="3" class="next">></label>
<div class="content">
<img src="http://www.cegepsherbrooke.qc.ca/~cpi/images/photo_4-3.jpg">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="3" value="3" checked="">
<label for="2" class="previous"><</label>
<label for="4" class="next">></label>
<div class="content">
<img src="http://www.projectorcentral.com/images/articles/4-3%20Bristlecone%20Pines.jpg">
</div>
</div>
<div class="group">
<input type="radio" name="test" id="4" value="4">
<label for="3" class="previous"><</label>
<label for="0" class="next">></label>
<div class="content">
<img src="http://www.wallpaperawesome.com/wallpapers-awesome/wallpapers-for-monitor-4-3-almost-square-awesome/wallpaper-for-monitor-4-3-almost-square-awesome-951.jpg">
</div>
</div>
</div>
</div>
</body>
</html>