Progress step tracker does not scale down in size - html

I am making a progress step tracker, like the type you'd see in multi-page forms, using CSS and Bootstrap and I am having issues with it scaling down to different screen sizes.
When I move to certain smaller screen sizes, I am having issues with the bars between the steps moving further left then their steps.
My markdown:
<div class="row">
<div class="col-xs-6 col-xs-offset-3 col-sm-6 col-sm-offset-3 col-md-6 col-md-offset-3 col-lg-6 col-ls-offset-3">
<div class="work-order-progress">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center first-item">
<span class="step-number">1</span>
<span class="step-name">Initial Approval</span>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
<span class="step-number">2</span>
<span class="step-name">Work In Progress</span>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
<span class="step-number">3</span>
<span class="step-name">Final Approval</span>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
<span class="step-number">4</span>
<span class="step-name">Complete</span>
</div>
</div>
</div>
</div>
And my style sheet:
.work-order-progress {
.div {
margin-right: 75px;
vertical-align: top;
display: inline-block;
text-align: center;
font-weight: bold;
}
.step-number {
border-radius: 0.8em;
-moz-border-radius: 0.8em;
-webkit-border-radius: 0.8em;
display: inline-block;
line-height: 1.6em;
margin-right: 5px;
text-align: center;
width: 1.6em;
}
:not(.first-item) {
.step-number:before {
width: 85%;
height: 5px;
content: '';
position: absolute;
top: 10px;
left: -87px;
z-index: -1;
border-radius: 25px
}
}
.step-name {
display: block;
color: #a5a5a5;
font-weight: bold;
}
.fill {
.step-number {
color: #ffffff;
background: #22a925;
}
.step-number:before {
background-color: #22a925;
}
}
:not(.fill) {
.step-number {
color: #a5a5a5;
background: #ededed;
border: 1px solid;
}
.step-number:before {
background-color: #ededed;
}
}
}
I am conditionally adding the class that makes it active based on business logic, which is removed in this example.

I built a live demo here:
.work-order-progress .div {
margin-right: 75px;
vertical-align: top;
display: inline-block;
text-align: center;
font-weight: bold;
}
.work-order-progress>div{
}
.work-order-progress .step-number {
border-radius: 0.8em;
-moz-border-radius: 0.8em;
-webkit-border-radius: 0.8em;
display: inline-block;
line-height: 1.6em;
margin-right: 5px;
text-align: center;
width: 1.6em;
}
.work-order-progress :not(.first-item) .step-number:before {
width: calc(100% - 35px);
height: 5px;
content: '';
position: absolute;
top: 10px;
left: calc(-50% + 15px);
z-index: -1;
border-radius: 25px;
}
.work-order-progress .step-name {
display: block;
color: #a5a5a5;
font-weight: bold;
}
.work-order-progress .fill .step-number {
color: #ffffff;
background: #22a925;
}
.work-order-progress .fill .step-number:before {
background-color: #22a925;
}
.work-order-progress :not(.fill) .step-number {
color: #a5a5a5;
background: #ededed;
border: 1px solid;
}
.work-order-progress :not(.fill) .step-number:before {
background-color: #ededed;
}
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="row">
<div class="col-xs-6 col-xs-offset-3 col-sm-6 col-sm-offset-3 col-md-6 col-md-offset-3 col-lg-6 col-ls-offset-3">
<div class="work-order-progress">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center first-item">
<span class="step-number">1</span>
<span class="step-name">Initial Approval</span>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
<span class="step-number">2</span>
<span class="step-name">Work In Progress</span>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
<span class="step-number">3</span>
<span class="step-name">Final Approval</span>
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 text-center">
<span class="step-number">4</span>
<span class="step-name">Complete</span>
</div>
</div>
</div>
</div>

Related

I have two items that appear to be centered in the code and individually on the page, but when aligned they are not

I have a button near the bottom of the page that is centered. Additionally, I have three images that I centered by making each image a col-lg-2 with 3 empty columns in between each one. I cannot figure out why these two items don't line up nicely, and which one is the one that is off center.
https://codepen.io/colesam/full/OgamyB/
SCSS:
a {
color: $blue;
font-size: 1.4vw;
font-weight: 500;
line-height: 1.7vw;
transition: all 0.2s;
&:hover {
color: $orange;
font-size: 1.7vw;
cursor: pointer;
text-decoration: none;
}
&:focus {
color: $blue;
text-decoration: none;
&:hover {
color: $orange;
cursor: pointer;
}
}
}
body {
background: white;
color: $black;
font-family: 'Roboto', sans-serif;
font-weight: 300;
text-shadow: $text-shadow-light;
}
h2 {
font-size: 5vh;
margin-top: 5vh;
}
p {
font-size: 3vh;
letter-spacing: 2px;
margin-top: 3vh;
text-shadow: none;
}
.btn-next {
bottom: 0;
padding-bottom: 5vh;
position: absolute;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
.center-text {
text-align: center;
}
.left-text {
text-align: left;
}
.no-margin {
margin: 0;
}
.right-text {
text-align: right;
}
.title {
padding-left: 4vw;
h3 {
font-size: 3vw;
text-shadow: $text-shadow;
}
}
#portfolio-page {
min-height: 100vh;
position: relative;
}
h4 {
font-size: 2vw;
}
.active-item {
box-shadow: $box-shadow-o;
-moz-box-shadow: $box-shadow-o;
-webkit-box-shadow: $box-shadow-o;
}
.btn-portfolio {
padding-top: 20vh;
text-align: center;
transition: all 0.3s;
a {
font-size: 5vw;
&:hover {
font-size: 5.5vw;
}
}
}
#featured-content {
background: rgba(0, 0, 0, 0.1);
height: 65vh;
margin-top: 2vh;
padding: 3vh 0;
}
#featured-img img {
box-shadow: $box-shadow-light;
-moz-box-shadow: $box-shadow-light;
-webkit-box-shadow: $box-shadow-light;
}
#primary-featured {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
height: 45.5vh;
top: 10%;
}
#secondary-featured {
margin-top: 3vh;
}
HTML(inside a div.container):
<div id="portfolio-page">
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<h2 class="center-text">My Portfolio</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12" id="featured-content">
<div class="row no-margin">
<div class="col-lg-1 btn-portfolio" id="left-button">
<a><i class="glyphicon glyphicon-chevron-left"></i></a>
</div>
<div class="col-lg-8 col-lg-offset-1" id="primary-featured">
<div class="row">
<div class="col-lg-5" id="featured-img">
<img src="includes/img/headers.jpg" alt="A cluster of header images." class="img-responsive">
</div>
<div class="col-lg-6 col-lg-offset-1" class="center-text">
<h4 id="featured-title">Placeholder</h4>
<hr>
<p id="featured-description">Placeholder text.</p>
</div>
</div>
</div>
<div class="col-lg-1 col-lg-offset-1 btn-portfolio" id="right-button">
<a><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
<div class="col-lg-6 col-lg-offset-3" id="secondary-featured">
<div class="row">
<div class="col-lg-2" id="secondary-feature1">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature2">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
<div class="col-lg-2 col-lg-offset-3" id="secondary-feature3">
<img src="includes/img/placeholder.jpg" alt="A placeholder image." class="img-responsive">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
</div>
Edit: Your problem is with position: absolute on .btn-next.
For absolutely positioned elements
This property specifies the distance between the left margin edge of
the element and the left edge of its containing block.
You have margin-left: -15px, so it aligns to center with the margin-left: -15px.
How to fix:
Add this to .btn-next:
right: 0;
left: 0;
...or you can remove position: absolute from .btn-next.
Alternative option:
The "down arrow" at the bottom isn't centered, because it's in the row class and that class has margin-left: 15px and margin-right: 15px.
If you give it margin: 0px, it'll be fine.
Rename div class="row" to something else or give it another class like div class="row down".
Examples:
<div class="down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
or
<div class="row down">
<div class="col-lg-12 btn-next">
<a>
<i class="glyphicon glyphicon-chevron-down"></i>
</a>
</div>
</div>
CSS (only if using second option):
.row.down {
margin: 0px;
}

My page doesn't go further down. All the elements I put below go on existing elements

I coded the first part of my page but when I try to go further down the elements don't go below but on existing elements. The page has a huge picture all over it with some text, but I want to put other text below the picture not on it.
.content {
text-align: center;
margin-top: 15%;
color: #fff;
}
h1 {
font-size: 80px;
font-weight: 700;
color: #fff;
}
.under {
font-size: 30px;
margin-top: 15px;
}
.button {
margin-top: 15%;
font-size: 25px;
}
.fa {
font-size: 80px;
}
.button {
padding: 20px 10px;
background-color: orange;
border-radius: 15px;
}
body {
background-image: url(https://source.unsplash.com/bmnuRawqdsI);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
html {
width: 100%;
height: 100%;
}
.body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(44, 48, 56, 0.5);
background: rgba(44, 48, 56, 0.5);
color: rgba(44, 48, 56, 0.5);
}
<div class="body">
<div class="container">
<div class="content">
<i class="fa fa-coffee" aria-hidden="true"></i>
<h1>You Order. We Deliver.</h1>
<p class="under">Get Coffee In 3 Easy Steps.</p>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-0">
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<p class="button">Order A Coffee</p>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-0">
</div>
</div>
</div>
</div>
</div>
<div class="container">
<h1>How It Works.</h1>
<div class="row">
<div class="col-lg-4 col-md4 col-sm-4 col-xs-12">
<p>Order any coffee from one of our many brands.</p>
</div>
<div class="col-lg-4 col-md4 col-sm-4 col-xs-12">
</div>
<div class="col-lg-4 col-md4 col-sm-4 col-xs-12">
</div>
</div>
</div>

Aligning Circles horizontally in Bootstrap

I don't have that great over bootstrap yet and cannot figure out how to properly position these circles equally under the title. Any help would be great I've tried many things. I think I've missed something stupid that I should of seen.
HTML
<div class="container">
<div class="row">
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif1"></div>
</div>
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif2"></div>
</div>
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif3"></div>
</div>
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif4"></div>
</div>
</div>
</div>
CSS
#dif1 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(41, 168, 224);
padding-top: 100px;
}
#dif2 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(221, 126, 81);
}
#dif3 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(175, 79, 122);
}
#dif4 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(138, 166, 90);
}
Just Remove padding-top: 100px; property from #dif1 selector
#dif1 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(41, 168, 224);
}
#dif2 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(221, 126, 81);
}
#dif3 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(175, 79, 122);
}
#dif4 {
width: 100px;
height: 100px;
border-radius: 50%;
display: inline-block;
color: white;
background: rgb(138, 166, 90);
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<div class="container">
<div class="row">
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif1"></div>
</div>
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif2"></div>
</div>
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif3"></div>
</div>
<div class="col-xs-2 col-md-2 col-lg-2">
<div id="dif4"></div>
</div>
</div>
</div>

Problems with bootstrap columns in extra small devices

I am experiencing a problem on bootstrap columns on extra small devices. In extra small devices the bootstrap columns overflow and changes the alignment.
I am attaching screenshots from extra small device and other device.
Screenshot of extra small device:
Screenshot of other device(working fine):
Below code is the bootstrap code.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="manu.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="header row">
<div class="time_remain col-sm-6 col-xs-6 col-md-6 col-ld-6">00 Min 00 Sec</div>
<div class="logout col-sm-6 col-xs-6 col-md-6 col-ld-6">Logout</div>
</div>
<div class="row frame">
<div class="col-sm-9 col-xs-9 col-md-9 col-ld-9 question_wrapper">
<div class="row questions">
1. This is first one?
</div>
<div class="row no-gutters choice_label_choice">
<div class="col-sm-1 col-xs-1 col-md-1 col-ld-1 answer_choice_label_div">
A
</div>
<div class="col-sm-11 col-xs-11 col-md-11 col-ld-11 answer_choice_div">
First
</div>
</div>
<div class="row no-gutters choice_label_choice">
<div class="col-sm-1 col-xs-1 col-md-1 col-ld-1 answer_choice_label_div">
B
</div>
<div class="col-sm-11 col-xs-11 col-md-11 col-ld-11 answer_choice_div">
Second
</div>
</div>
<div class="row no-gutters choice_label_choice">
<div class="col-sm-1 col-xs-1 col-md-1 col-ld-1 answer_choice_label_div">
C
</div>
<div class="col-sm-11 col-xs-11 col-md-11 col-ld-11 answer_choice_div">
Third
</div>
</div>
<div class="row no-gutters choice_label_choice">
<div class="col-sm-1 col-xs-1 col-md-1 col-ld-1 answer_choice_label_div">
D
</div>
<div class="col-sm-11 col-xs-11 col-md-11 col-ld-11 answer_choice_div">
Fourth
</div>
</div>
</div>
<div class="col-sm-3 col-xs-3 col-md-3 col-ld-3 question_status_wrapper">.col-sm-3</div>
</div>
<div class="row status_bar">
<div class="col-sm-3 col-xs-3 col-md-1 col-ld-1 time_bar"><div>00 MIN 00 SEC</div> </div>
<div class="col-sm-3 col-xs-3 col-md-1 col-ld-1 time_bar"><div>Back</div></div>
<div class="col-sm-3 col-xs-3 col-md-1 col-ld-1 time_bar"><div>Next</div></div>
<div class="col-sm-0 col-xs-0 col-md-6 col-ld-6 "></div>
<div class="col-sm-3 col-xs-3 col-md-1 col-ld-1 time_bar"><div>Submit</div></div>
</div>
</div>
</body>
</html>
The css code is given below.
.frame
{
height: 70vh;
}
.question_wrapper
{
height: inherit;
background-color: beige;
overflow: auto;
padding-left: 20px;
padding-right: 20px;
}
.time_remain
{
padding-top: 5px;
color: white;
text-align: left;
padding-left: 20px;
}
.logout
{
color: white;
text-align: right;
padding-right: 20px;
padding-top: 5px;
}
.question_status_wrapper
{
height: inherit;
background-color: bisque;
overflow: auto;
}
.header
{
height: 10vh;
background-color: #333333;
color: white;
}
.status_bar
{
position: fixed;
bottom: 0;
width: 100%;
height: 20vh;
background-color : #333333;
display: flex;
}
.questions
{
margin-top: 20px;
margin-left: 20px;
}
.answer_choice_label_div
{
background-color: black;
color: white;
text-align: center;
height: inherit;
vertical-align: inherit;
border-style: solid;
border-width: 2px;
}
.answer_choice_div
{
background-color: white;
color: black;
height: inherit;
vertical-align: inherit;
border-style: solid;
border-width: 2px;
overflow: inherit;
}
.answer_choice_div:hover
{
background-color: #C6FFF1;
color: black;
height: inherit;
vertical-align: inherit;
border-style: solid;
border-width: 2px;
overflow: inherit;
}
.choice_label_choice
{
margin-top: 10px;
margin-bottom: 10px;
min-height: 10vh;
height: 50px;
vertical-align: middle;
}
.time_bar
{
background-color: aliceblue;
color: black;
align-self: center;
text-align: center;
margin-left: 10px;
min-height: 6vh;
display: inline;
vertical-align: middle;
margin-right: 10px;
padding-top: 7px;
}
I have checked the bootstrap grid and didn't find any problem. Please help.
Use media queries , Paste this code in your style.css
#media only screen and (max-width: 580px)
{
.answer_choice_div
{
width: 83%;
}
.answer_choice_label_div
{
width: 10%;
}
}
Use xs for extra small devices. sm for small devices and md for medium devices.
Follow this link for Grid Options
Grid Options - Bootstrap

Trouble with a checkbox inside a div with a dynamic height, how to do?

I've got a lot of trouble with getting my checkboxes vertical aligned in my divs with a dynamic height.
I have some of my view:
<div class="col-md-7">
<div class="row recent-information">
<div class="product-navigation">
<div class="product-header-text">
<div class="col-md-3 product-details">
<p>Product name</p>
</div>
<div class="col-md-4 product-details">
<p>Note</p>
</div>
<div class="col-md-2 product-details">
<p>Price</p>
</div>
<div class="col-md-2 product-details">
<p>Stock</p>
</div>
</div>
</div>
#foreach (var item in Model.Products)
{
<div class="product-header">
<div class="product-header-text">
<div class="col-md-3 product-details-entity">
<h6>#item.Name</h6>
</div>
<div class="col-md-4 product-details-entity">
<h6>#item.Description</h6>
</div>
<div class="col-md-2 product-details-entity">
<h6>#item.Price DKK</h6>
</div>
<div class="col-md-1 product-details-entity">
<h6>#item.Stock</h6>
</div>
<div class="col-md-1 product-details-checkbox">
#Html.CheckBox("naem", new { #class = "products-checkbox" })
</div>
</div>
</div>
}
</div>
</div>
And the style:
.product-header {
min-height: 7%;
min-width: 100%;
margin-bottom: 3px;
border-bottom: 1px solid #e6e6e6;
overflow: hidden;
}
.product-header-text {
width: 98%;
margin-left: 10px !important;
margin-right: 10px !important;
float: left;
font-weight: 700 !important;
margin-bottom: 3px;
height: 100%;
}
.product-details {
font-weight: 500 !important;
margin-top: 13px;
font-family: 'Raleway', sans-serif;
font-size: 12px;
height: auto;
min-height: 100%;
}
.product-details-entity {
margin-top: 20px;
height: auto;
}
input[type="checkbox"] {
background: #f8f8f5;
-webkit-appearance: none;
height: 22px;
width: 22px;
margin-top: 20%;
cursor: pointer;
margin-left: 65px;
}
input[type="checkbox"]:checked {
background-image: url("../Images/checkmark2.png");
height: 22px;
width: 22px;
}
My problem is, that my divs, the product-details are dynamically based on the content from the database, and I can't get my checkboxes to follow.