I am trying to implement the step progress bar and I have done the below for the desktop version.
Photo who works on the desktop like
Desktop Version
When I try to do it horizontally on a mobile that does not work, it appears vertically
Photo who works in the mobile
Mobile Version
Code Html :
<div class="progress">
<ul1>
<li>
<i class="fa fa-check"></i>
<p>Email</p>
</li>
<li>
<i class="fa fa-refresh"></i>
<p>Register form</p>
</li>
<li>
<i class="fa fa-times"></i>
<p>Done</p>
</li>
</ul1>
</div>
CSS Code :
.progress{
margin-left: 10px auto;
}
.progress img{
width: 80px;
margin-bottom: 20px;
}
ul1{
text-align: center;
}
ul1 li{
display: inline-block;
width: 200px;
position: relative;
margin-top: 10px;
}
ul1 li .fa{
background: #ccc;
height: 26px;
color: #fff;
border-radius: 50%;
padding: 5px;
}
ul1 li .fa::after{
content: '';
background: #ccc;
height: 5px;
width: 205px;
display: block;
position: absolute;
left: 0;
top: 60px;
z-index: -1;
}
ul1 li:nth-child(2) .fa{
background: #ca261a;
}
ul1 li:nth-child(2) .fa::after{
background: #ca261a;
}
ul1 li:nth-child(1) .fa
{
background: #60aa97;
}
ul1 li:nth-child(1) .fa::after
{
background: #60aa97;
}
ul1 li:first-child .fa::after{
width: 105px;
left: 100px;
}
ul1 li:last-child .fa::after{
width: 105px;
}
You use fixed width (in px unit) while overall width from 3 li is wider than screen size.
To fix this, use fluid width such as percentage (%).
.progress {
margin-left: 10px auto;
}
.progress img {
width: 80px;
margin-bottom: 20px;
}
/* use media queries to smaller font size on small screen to prevent them push bar to vertical. */
.progress p {
font-size: 12px;
}
#media (min-width: 400px) {
.progress p {
font-size: initial;
}
}
ul {
list-style: none;
text-align: center;
}
ul li {
list-style: none;
display: inline-block;
width: 30.33%;/* make it fluid */
position: relative;
margin-top: 10px;
}
ul li .fa {
background: #ccc;
height: 26px;
color: #fff;
border-radius: 50%;
padding: 5px;
}
ul li .fa::after {
content: '';
background: #ccc;
height: 5px;
width: 100%;/* make it fluid */
display: block;
position: absolute;
left: 0;
top: 60px;
z-index: 0;/* higher than last step */
}
ul li:nth-child(2) .fa {
background: #ca261a;
}
ul li:nth-child(2) .fa::after {
background: #ca261a;
}
ul li:nth-child(1) .fa {
background: #60aa97;
}
ul li:nth-child(1) .fa::after {
background: #60aa97;
}
ul li:first-child .fa::after {
width: 100%;
left: 50%;
}
ul li:last-child .fa::after {
width: 60%;/* +10 for -10 in left property */
left: -10%;/* for remove empty space on left */
z-index: -1;/* put to bottom */
}
<div class="progress">
<ul>
<li>
<i class="fa fa-check"></i>
<p>Email</p>
</li>
<li>
<i class="fa fa-refresh"></i>
<p>Register form</p>
</li>
<li>
<i class="fa fa-times"></i>
<p>Done</p>
</li>
</ul>
</div>
I've changed your CSS a little, please read in code comment (/* comment */).
However, you may found that in very small screen the font maybe very small. This is for prevent the progress step push to new line. It is not good fix but it can be helped.
Smallest screen tested is 320pixels.
See it on jsfiddle.
Related
I tried to create a responsive menu for a smaller screen, but the icon fa fa-bar would not appear, even though I set display: block inside media query. I wonder what the priority in css is. I followed a tutorial on reponsive menu, yet my code in media does not reflect on the smaller screen.
nav {
display: flex;
padding: 2% 6%;
justify-content: space-between;
align-items: center;
}
.nav img {
width: 150px;
}
.nav-links {
flex: 1;
text-align: right;
}
.nav-links ul li {
list-style: none;
display: inline-block;
padding: 8px 12px;
position: relative;
}
.nav-links ul li a {
color: white;
text-decoration: none;
font-weight: 500;
}
.nav-links ul li::after {
content: "";
width: 100%;
height: 2px;
display: block;
margin: auto;
}
.nav-links ul li:hover::after {
width: 100%;
}
#media (max-width: 700px) {
.nav-links ul li {
display: block;
}
.nav-links {
position: absolute;
background: #012a5d;
height: 100vh;
width: 200px;
top: 0;
right: -200px;
text-align: left;
z-index: 2;
transition: 1s;
}
nav.fa {
display: block;
color: #fff;
margin: 10px;
font-size: 22px;
cursor: pointer;
}
.nav-links ul {
padding: 30px;
}
}
<nav>
<div class="logo">
<img src="images/Logos/University of Toronto Logos/U of T Signature_Reverse RGB (1).png">
</div>
<div class="nav-links" id="navLinks">
<i class="fa fa-times" onclick="hideMenu()"></i>
<ul>
<li>Home</li>
...
<li><a href="contact.html" class="button-header">
<div class="button-font">
Contact Us
</div>
</a></li>
</ul>
</div>
<i class="fa fa-bars" onclick="showMenu()"></i>
</nav>
<script>
var navLinks = document.getElementById("navLinks");
function showMenu()
{navlinks.style.right ="0";}
function hideMenu()
{ navlinks.style.right = "-200";}
</script>
how the menu looks like on a big screen
I really don't know what should be the correct title for this question, but I have a custom menu I have created and using JQuery to toggle, it looks like this.
<ul class="menu">
<li class="user-info">
<span class="fa fa-user"></span>
<a class="inline" href="https://example.com/">account</a>
<ul class="items">
<li class="item">
<span class="fa fa-lock"></span>
<a class="inline" href="https://example.com/register">Create Account</a>
</li>
<li class="item">
<span class="fa fa-login"></span>
<a class="inline" href="https://example.com/login">Account Login</a>
</li>
</ul>
</li>
</ul>
And here is my CSS code
ul, ul li, ol, ol li {
display: block;
margin: 0;
padding: 0;
list-style: none;
}
#media (max-width: 540px) {
#sidebar ul.menu {
height: auto!important;
}
}
#sidebar .menu {
height: calc(100vh - 94px);
overflow: auto;
transition: 200ms ease-out height;
}
#media (max-width: 540px) {
#sidebar ul.menu li {
width: 20%;
float: left;
margin: 0!important;
text-align: center;
padding: 10px 5px;
z-index: 111;
height: 50px;
}
}
#sidebar ul li {
font-weight: 400;
font-size: 10pt;
text-transform: capitalize;
position: relative;
cursor: pointer;
}
#media (max-width: 540px) {
#sidebar ul.menu li ul {
background: #222629;
border-bottom: 1px solid rgb(255 255 255 / 08%);
right: 0;
left: 0;
bottom: 50px;
top: 0;
position: fixed!important;
display: block;
opacity: 0;
visibility: hidden;
transition: 200ms ease-in all;
overflow: auto;
width: 100%;
box-shadow: none;
}
}
#sidebar ul.menu li ul {
background: #222629;
}
#media (max-width: 540px) {
#sidebar ul.menu li.shown ul {
opacity: 1;
visibility: visible;
display: block!important;
}
}
So far everything works well on all platforms except iOS although, I haven't tried on MAC, but I've tested across over 5 iOS devices including iOS 14.1 but the menu wont toggle when the .shown class is appended to the li.user-info item.
What am I doing wrongly?
EDIT:
I have updated my css to include this at the top:
#sidebar ul.menu li.shown ul {
opacity: 0;
visibility: hidden;
display: none;
}
Still doesn't work, I have also set opacity:1 and visibility:visible and display:block in the above piece of code, still, nothing worked.
Update: There is no element with a .menu_wrapper class, there was a typo, I mistakenley copied css from my old code for this question, I had to come up with simpler naming conventions to aid debugging.
I have tried to embed a vertical menu bar on my Blogger website. But it seems like it's not responsive and the colour is not matching my website.
I need to remove the shadow and make the website responsive in mobile.
My website's background colour is white: https://codemyquestion.blogspot.com/
This is how it is opened:
This is the expected output:
Below is the code:
<style>
.ddsmoothmenu-v ul {
margin: 0;
padding: 0;
width: 130px;
/* Main Menu Item widths */
list-style-type: none;
font: bold 12px Verdana;
border-bottom: 0px solid #ccc;
}
.ddsmoothmenu-v ul li {
position: relative;
}
.downarrowclass {
position: absolute;
top: 12px;
right: 7px;
}
.rightarrowclass {
position: absolute;
top: 10px;
right: 5px;
}
/* Top level menu links style */
.ddsmoothmenu-v ul li a {
display: block;
overflow: auto;
/*force hasLayout in IE7 */
height: 32px;
color: white;
text-decoration: none;
padding: 5px 5px 5px 25px;
border-bottom: 0px solid #778;
border-right: 0px solid #778;
}
.ddsmoothmenu-v ul li a:link, .ddsmoothmenu-v ul li a:visited, .ddsmoothmenu-v ul li a:active {
color: white;
background-image: url(http://3.bp.blogspot.com/-VCtcZunZJ2U/T9W7MM1uIXI/AAAAAAAAB9o/yVJ0Cad3Q0g/s1600/tab_bg.gif);
height: 22px;
background-repeat: repeat-x;
background-position: left center;
margin-bottom: 1px;
}
.ddsmoothmenu-v ul li a.selected {
/*CSS class that's dynamically added to the currently active menu items' LI A element*/
color: white;
background-image: url(http://2.bp.blogspot.com/-F0-PrDUYlX4/T9W7MrjME5I/AAAAAAAAB9w/0CLQurrHUjM/s1600/tabhover_bg.gif);
height: 22px;
background-repeat: repeat-x;
background-position: left center;
}
.ddsmoothmenu-v ul li a:hover {
color: white;
background-image: url(http://2.bp.blogspot.com/-F0-PrDUYlX4/T9W7MrjME5I/AAAAAAAAB9w/0CLQurrHUjM/s1600/tabhover_bg.gif);
height: 22px;
background-repeat: repeat-x;
background-position: left center;
}
/*Sub level menu items */
.ddsmoothmenu-v ul li ul {
position: absolute;
width: 170px;
/*Sub Menu Items width */
height: 22px;
top: 0;
font-weight: normal;
visibility: hidden;
}
/* Holly Hack for IE \*/
* html .ddsmoothmenu-v ul li {
float: left;
height: 1%;
}
* html .ddsmoothmenu-v ul li a {
height: 1%;
}
/*======= Vertical Drop Down Menu By Helper Blogger ========= */
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://helperblogger.ucoz.com/code/hb-smooth-menu.js"></script>
<script type="text/javascript">
})
</script>
<script type="text/javascript">
ddsmoothmenu.init({
mainmenuid: "smoothmenu2",
//Menu DIV id
orientation: 'v',
//Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu-v',
//class added to menu's outer DIV
//customtheme: ["#804000", "#482400"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})
</script>
<div id="smoothmenu2" class="ddsmoothmenu-v">
<ul>
<li>
Home
</li>
<li>
Folder 0
<ul>
<li>
Sub Item 1.1
</li>
<li>
Sub Item 1.2
</li>
</ul>
</li>
<li>
Folder 1
<ul>
<li>
Sub Item 1.1
</li>
<li>
Sub Item 1.2
</li>
</ul>
</li>
<li>
Item 3
</li>
<li>
Folder 2
<ul>
<li>
Sub Item 2.1
</li>
</ul>
</li>
<li>
Create This
</li>
</ul>
<br style="clear: left" />
</div>
the black white nav menu:
HTML
<div class="sidenav">
<i class="fa fa-home"></i> About
<i class="fa fa-home"></i> Services
<i class="fa fa-home"></i> Clients
<i class="fa fa-home"></i> Contact
<div href="#" class="dropdown-btn">
<i class="fa fa-home"></i>
<i class="fa fa-caret-right"></i>Dropdown
<div class="dropdown-container">
Link 1
Link 2
Link 3
</div>
</div>
<i class="fa fa-home"></i> Search
</div>
CSS
.sidenav {
height: 100%;
width: 58px;
position: relative;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
padding: 20px 0;
white-space: nowrap;
overflow-x:hidden;
transition: all 0.2s ease-in-out;
}
.sidenav:hover {
width: 200px;
overflow-x:visible;
}
.sidenav .fa:not(.fa-caret-right){
margin-right:20px;
}
.sidenav a, .dropdown-btn {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 20px;
color: #818181;
display: block;
border: none;
background: none;
width: 100%;
text-align: left;
cursor: pointer;
outline: none;
}
.sidenav a:hover, .dropdown-btn:hover {
color: #f1f1f1;
position:relative;
}
.dropdown-btn:hover .dropdown-container{
display:block;
}
.dropdown-container {
display: none;
background-color: #262626;
padding-left: 8px;
position:absolute;
width:200px;
left:100%;
margin-top:-30px;
}
.fa-caret-right {
float: right;
padding-right: 8px;
display:none !important;
}
the sub-menu opens to the right side, if you want to open it from the left side use this code:
HTML
<div class="sidenav">
<i class="fa fa-home"></i> About
<i class="fa fa-home"></i> Services
<i class="fa fa-home"></i> Clients
<i class="fa fa-home"></i> Contact
<div href="#" class="dropdown-btn">
<i class="fa fa-home"></i>
Dropdown
<i class="fa fa-caret-left"></i>
<div class="dropdown-container">
Link 1
Link 2
Link 3
</div>
</div>
<i class="fa fa-home"></i> Search
</div>
CSS
.sidenav {
direction:rtl;
height: 100%;
width: 58px;
position: relative;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
padding: 20px 0;
white-space: nowrap;
overflow-x:hidden;
transition: all 0.2s ease-in-out;
}
.sidenav:hover {
width: 200px;
overflow-x:visible;
}
.sidenav .fa:not(.fa-caret-left){
margin-left:20px;
}
.sidenav a, .dropdown-btn {
padding: 6px 16px 6px 8px;
text-decoration: none;
font-size: 20px;
color: #818181;
display: block;
border: none;
background: none;
width: 100%;
text-align: right;
cursor: pointer;
outline: none;
}
.sidenav a:hover, .dropdown-btn:hover {
color: #f1f1f1;
position:relative;
}
.dropdown-btn:hover .dropdown-container{
display:block;
}
.dropdown-container {
display: none;
background-color: #262626;
padding-right: 8px;
position:absolute;
width:200px;
right:100%;
margin-top:-30px;
}
.fa-caret-right {
float: left;
display:none !important;
}
Funny, I recently made my online web-game mobile responsive too. I can help:
The problem is px. Don't use px for mobile websites. Instead, use percent (%) or viewport-width (vw) these will make it so the elements will resize to the browser size.
Absolute positioning. It will override the width of the page if the elements are not inside a div. If it's in a div, It'll not follow the width of that div. Instead, use position: relative because this is relative to the width or height of the viewport page.
Try resizing your browser on your laptop/desktop, and notice the elements match. Next:
Use the CSS3 max-width property so on laptop, it'll look fine. But on mobile devices it'll probably look like a smaller version of the desktop sized screen. For example:
will look the same on a mobile device but smaller.
Now, finally, you can use: <meta> HTML tag. It definitely works on texts, images, Etc. Here's how:
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
use these tricks and your website is ready for mobile devices.
Edit: I saw your website. Everything looks fine on my laptop.
What exactly is wrong?
you just need to make some changes in your style
<style>
.ddsmoothmenu-v ul {
margin: 0;
padding: 0;
width: 130px;
/* Main Menu Item widths */
list-style-type: none;
font: bold 12px Verdana;
border-bottom: 0px solid #ccc;
}
.ddsmoothmenu-v ul li {
position: relative;
}
.downarrowclass {
position: absolute;
top: 12px;
left: 7px;
transform:rotateY(180deg); /* change the right arrow to left arrow */
}
.rightarrowclass {
position: absolute;
top: 10px;
left: 5px;
transform:rotateY(180deg); /* change the right arrow to left arrow */
}
/* Top level menu links style */
.ddsmoothmenu-v ul li a {
display: block;
overflow: auto;
/*force hasLayout in IE7 */
height: 32px;
color: white;
text-decoration: none;
padding: 5px 5px 5px 25px;
border-bottom: 0px solid #778;
border-right: 0px solid #778;
}
.ddsmoothmenu-v ul li a:link, .ddsmoothmenu-v ul li a:visited, .ddsmoothmenu-v ul li a:active {
color: white;
background-image: url(http://3.bp.blogspot.com/-VCtcZunZJ2U/T9W7MM1uIXI/AAAAAAAAB9o/yVJ0Cad3Q0g/s1600/tab_bg.gif);
height: 22px;
background-repeat: repeat-x;
background-position: left center;
margin-bottom: 1px;
}
.ddsmoothmenu-v ul li a.selected {
/*CSS class that's dynamically added to the currently active menu items' LI A element*/
color: white;
background-image: url(http://2.bp.blogspot.com/-F0-PrDUYlX4/T9W7MrjME5I/AAAAAAAAB9w/0CLQurrHUjM/s1600/tabhover_bg.gif);
height: 22px;
background-repeat: repeat-x;
background-position: left center;
}
.ddsmoothmenu-v ul li a:hover {
color: white;
background-image: url(http://2.bp.blogspot.com/-F0-PrDUYlX4/T9W7MrjME5I/AAAAAAAAB9w/0CLQurrHUjM/s1600/tabhover_bg.gif);
height: 22px;
background-repeat: repeat-x;
background-position: left center;
}
/*Sub level menu items */
.ddsmoothmenu-v ul li ul {
position: absolute;
width: 170px;
/*Sub Menu Items width */
height: 22px;
top: 0;
font-weight: normal;
visibility: hidden;
left:-170px !important; /* move the sub-menu to the left */
box-shadow:none !important; /* remove the shadow */
}
/* Holly Hack for IE \*/
* html .ddsmoothmenu-v ul li {
float: left;
height: 1%;
}
* html .ddsmoothmenu-v ul li a {
height: 1%;
}
/*======= Vertical Drop Down Menu By Helper Blogger ========= */
</style>
I have the below screen where there is a space at the top of the vc-e-att-26 text. I tried all possible ways I could think of including negative margin. But it still doesn't work.
Mt html file is :
And my scss file is :
I need the vcs-e-att-26 txt to be in the same line as the bullet. Can anyone please help me with this.
There is a mistake in your HTML and CSS code, check the right code and solution here
DEMO
body{
margin:0;
}
ul {
list-style: none;
}
span.right-text {
float: right;
}
h4 {
margin:20px;
}
hr {
width:100%;
margin-right: 57%;
}
ul li.my-class::before {
background: red;
content: "";
width: 10px;
height: 10px;
position: absolute;
left: 0;
top: 4px;
border-radius: 50%;
}
ul li.my-class.green-circle::before{
background: green;
}
li.my-class {
position: relative;
padding-left: 20px;
}
.uptime-container{
background-color: white;
width: 40%;
margin-left: 20px;
margin-top: 20px;
}
<div class="uptime-container">
<h4>Uptime</h4>
<ul *ngFor="let data of chartData">
<li class="my-class red-circle">adadsadsad <span class="right-text">34324324234}</span></li>
<hr>
<li class="my-class green-circle">adadsadsad <span class="right-text">34324324234}</span></li>
<hr>
<li class="my-class green-circle">adadsadsad <span class="right-text">34324324234}</span></li>
<hr>
<li class="my-class green-circle">adadsadsad <span class="right-text">34324324234}</span></li>
<hr>
</ul>
</div>
There are some small mistakes:
nothing but LI can be the direct child of UL, you are having the P and other elements in UL, only LI can be directly present there and the rest will be the child of LI.
you have given the height and width directly to LI 10px, while all the data is present in you LI, that's why this mess was going on, if your data is dynamic and its can decrease and increase, its a very bad idea to give width to that element.
create your element with before or after or put an extra span for this round circle. don't style your complete LI like it.
Just a suggestion, Use flex instead of floats,
I have given the basic idea to you below use it,
ul {
list-style: none;
margin-right: 20px;
}
body {background-color: #ccc;}
li span{
color:black;
}
h4 {
margin:20px;
}
* {
padding: 0;margin: 0; box-sizing: border-box;
}
hr {
width:100%;
margin-right: 57%;
}
.uptime-container{
background-color: white;
margin: 20px;
padding: 20px;
max-width: 80%;
}
.uptime-container ul li span {position: relative; padding-left: 20px;}
.red-circle >span:after {
content: "";
width: 10px;
height: 10px;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
background: red;
margin-bottom: -5px;
display: block;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
.green-circle >span:after {
display: block;
content: "";
width: 10px;
height: 10px;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
background: green;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
.uptime-container ul li {
display: flex;
justify-content: space-between;
margin-bottom: 25px;
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
}
.uptime-container ul li:last-child {
margin-bottom: 0px;
}
<div class="uptime-container">
<h4>Uptime</h4>
<ul *ngFor="let data of chartData">
<li class="red-circle">
<span>VCS-e-at-26</span>
<p class="right-text">Down since lasrt 2 hours</p>
</li>
<li class="green-circle">
<span>VCS-e-at-26</span>
<p class="right-text">10 minutes</p>
</li>
<li class="red-circle">
<span>VCS-e-at-26</span>
<p class="right-text">Down since lasrt 2 hours</p>
</li>
<li class="green-circle">
<span>VCS-e-at-26</span>
<p class="right-text">10 minutes</p>
</li>
</ul>
</div>
I have a question, is it possible to have a full width dropdown menu when my wrapper has a width of 1024px (all contents are centered on screen)? Because I am having problems with my dropdown menu. Though, it is not yet working with the hover but I'm still trying to style my dropdown menu.
Here's my code:
#lower-header {
background-color: #ffffff;
height: 100px;
position: relative;
width: -webkit-fill-available;
z-index: 1;
img {
float: left;
margin-top: 33px;
}
ul {
list-style: none;
display: block;
float: left;
margin: 17px 0px;
padding-left: 30px;
li {
display: inline-block;
font-size: 17px;
font-weight: bold;
padding: 16px 19px;
height: 73px;
.sub-menu-whole {
background-color: #ffffff;
height: 360px;
/*position: absolute;*/
z-index: 1;
margin-top: 44px;
&:after {
content: "";
display: table;
clear: both;
}
div {
position: absolute;
margin: -33px 0;
padding: 0;
div {
float: right;
}
}
}
a {
text-decoration: none;
color: #000000;
&:hover {
color: red;
}
}
}
}
}
<div id="lower-header">
<div class="wrapper">
<img src="images/logo/logo_01.png">
<ul>
<li>
KU 스타트업
<div class="sub-menu-whole">
<div>
<img src="images/bg/bg_sub_01.png">
</div>
<div class="column">
<ul>
<li>
<a>인사말</a>
</li>
<li>
<a>창업부서소개</a>
</li>
</ul>
</div>
</div>
</li>
<li>프로그램</li>
<li>스타트업 리더</li>
<li>창업보육</li>
<li>창업멘토단</li>
<li>커뮤니티</li>
</ul>
</div>
</div>
Remove the float: left; property from the ul and add width:100%;