How to make tooltip above all elements inside absolute position and overflow? - html

I need to display a tooltip when hover an option of dropdown. The dropdown used here is react-windowed-select, which a wrapper of react-select. For some reasons, I end up create my own tooltip using css only (not invented by me though, found somewhere from internet). It work great, except, the tooltip is cropped (not fully displayed) for the first data of the options. Here is the screenshot of what I've done:
My objective, how to make this tooltip appear above everything?
Here is the code I'm working so far: https://codesandbox.io/s/friendly-wu-wlitr?file=/src/App.tsx
in case the link of the code broken, here is the code for the corresponding file:
CustomTooltip.tsx
import React from "react";
import "./CustomTooltip.css";
interface CustomTooltipProps {
dataTip: string;
children: React.ReactNode;
position?: "top" | "right" | "left" | "bottom";
}
export default function CustomTooltip({
children,
dataTip,
position = "top"
}: CustomTooltipProps) {
return (
<div className="tooltip-css">
<div
className={`qtip tip-${position}`}
data-tip={dataTip}
style={{ width: "100%" }}
>
{children}
</div>
</div>
);
}
Here is the styling, CustomTooltip.css
/*tipped element. should be inline-block or block*/
/**
source: https://speckyboy.com/free-css-tooltip-snippets/
*/
.tooltip-css {
/*the tip*/
/*top*/
/*bottom*/
/*left*/
/*right*/
/*some styles for this example*/
width: 100%;
}
.tooltip-css .qtip {
display: inline-block;
position: relative;
box-sizing: border-box;
font-style: default;
transition: all 0.7s ease-in-out;
overflow: visible;
}
.tooltip-css .qtip:hover {
cursor: default;
}
.tooltip-css .qtip:before {
content: attr(data-tip);
font-size: 14px;
position: absolute;
background: rgba(10, 20, 30, 0.85);
color: #fff;
line-height: 1.2em;
padding: 1em;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
min-width: 120px;
max-width: 400px;
width: fit-content;
text-align: center;
opacity: 0;
visibility: hidden;
transition: all 0.7s ease-in-out;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
letter-spacing: 0;
}
.tooltip-css .qtip:after {
width: 0;
height: 0;
border-style: solid;
content: "";
position: absolute;
opacity: 0;
visibility: hidden;
transition: all 0.7s ease-in-out;
}
.tooltip-css .qtip:hover:before,
.tooltip-css .qtip:hover:after {
visibility: visible;
opacity: 1;
overflow: visible;
}
.tooltip-css .qtip.tip-top:before {
top: 0;
left: 50%;
transform: translate(-50%, calc(-100% - 8px));
box-sizing: border-box;
border-radius: 3px;
}
.tooltip-css .qtip.tip-top:after {
border-width: 8px 8px 0 8px;
border-color: rgba(10, 20, 30, 0.85) transparent transparent transparent;
top: -8px;
left: 50%;
transform: translate(-50%, 0);
}
.tooltip-css .qtip.tip-bottom:before {
bottom: 0;
left: 50%;
transform: translate(-50%, calc(100% + 8px));
box-sizing: border-box;
border-radius: 3px;
}
.tooltip-css .qtip.tip-bottom:after {
border-width: 0 8px 8px 8px;
border-color: transparent transparent rgba(10, 20, 30, 0.85) transparent;
bottom: -8px;
left: 50%;
transform: translate(-50%, 0);
}
.tooltip-css .qtip.tip-left:before {
left: 0;
top: 50%;
transform: translate(calc(-100% - 8px), -50%);
box-sizing: border-box;
border-radius: 3px;
}
.tooltip-css .qtip.tip-left:after {
border-width: 8px 0 8px 8px;
border-color: transparent transparent transparent rgba(10, 20, 30, 0.85);
left: -8px;
top: 50%;
transform: translate(0, -50%);
}
.tooltip-css .qtip.tip-right:before {
right: 0;
top: 50%;
transform: translate(calc(100% + 8px), -50%);
box-sizing: border-box;
border-radius: 3px;
}
.tooltip-css .qtip.tip-right:after {
border-width: 8px 8px 8px 0;
border-color: transparent rgba(10, 20, 30, 0.85) transparent transparent;
right: -8px;
top: 50%;
transform: translate(0, -50%);
}
.tooltip-css body {
background: #3bb4e5;
}
.tooltip-css .container {
padding: 1.5em;
margin: 3em auto;
background: #fff;
position: relative;
max-width: 720px;
font-size: calc(2vmin + 12px);
line-height: 1.5em;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
font-weight: 500;
text-align: center;
}
.tooltip-css .container p {
margin: 0 auto 0.8em;
}
.tooltip-css .container h1 {
text-align: center;
line-height: 1em;
color: #d40;
margin: 0 auto 0.5em;
font-size: 2.5em;
}
.tooltip-css code {
color: #3bb4e5;
font-size: 0.8em;
padding: 1em;
background: #0a141e;
display: block;
text-align: left;
}
.tooltip-css .hl {
color: #eb1777;
}
.tooltip-css .qcontent {
color: #ff0;
font-weight: bold;
}
.tooltip-css .qclass {
color: #dd0;
font-weight: bold;
}
And here how I combine all of them, App.tsx
import "./styles.css";
import Select, { components } from "react-select";
import { CustomTooltip } from "./custom-tooltip";
const data = Array.from(Array(100)).map((item, index) => {
return {
value: index + 1,
label: `data ${index + 1}`
};
});
export default function App() {
return (
<div
style={{
width: "80%"
}}
>
<h1>Data</h1>
<Select
options={data}
components={{
Option: (props) => {
return (
<components.Option {...props}>
<CustomTooltip dataTip={`${props.data.label}`}>
<div>{`${props.data.value}`}</div>
</CustomTooltip>
</components.Option>
);
}
}}
/>
</div>
);
}

Related

How to turn around hover effect?

I need to turn around the hover effect of an element. Right now, the border disappears when you hover over it, but I want it to be hidden by default and only appears when you hover over it?
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #fcf3ec;
}
.button {
--offset: 10px;
--border-size: 2px;
display: block;
position: relative;
padding: 1.5em 3em;
appearance: none;
border: 0;
background: transparent;
color: #e55743;
text-transform: uppercase;
letter-spacing: .25em;
outline: none;
cursor: pointer;
font-weight: bold;
border-radius: 0;
box-shadow: inset 0 0 0 var(--border-size) currentcolor;
transition: background .8s ease;
}
.button:hover {
background: rgba(100, 0, 0, .03);
}
.button__horizontal,
.button__vertical {
position: absolute;
top: var(--horizontal-offset, 0);
right: var(--vertical-offset, 0);
bottom: var(--horizontal-offset, 0);
left: var(--vertical-offset, 0);
transition: transform .8s ease;
will-change: transform;
}
.button__horizontal::before .button__vertical::before {
content: '';
position: absolute;
border: inherit;
}
.button__horizontal {
--vertical-offset: calc(var(--offset) * -1);
border-top: var(--border-size) solid currentcolor;
border-bottom: var(--border-size) solid currentcolor;
}
.button__horizontal::before {
top: calc(var(--vertical-offset) - var(--border-size));
bottom: calc(var(--vertical-offset) - var(--border-size));
left: calc(var(--vertical-offset) * -1);
right: calc(var(--vertical-offset) * -1);
}
.button:hover .button__horizontal {
transform: scaleX(0);
}
.button__vertical {
--horizontal-offset: calc(var(--offset) * -1);
border-left: var(--border-size) solid currentcolor;
border-right: var(--border-size) solid currentcolor;
}
.button__vertical::before {
top: calc(var(--horizontal-offset) * -1);
bottom: calc(var(--horizontal-offset) * -1);
left: calc(var(--horizontal-offset) - var(--border-size));
right: calc(var(--horizontal-offset) - var(--border-size));
}
.button:hover .button__vertical {
transform: scaleY(0);
}
<button class="button">
Fancy Button
<div class="button__horizontal"></div>
<div class="button__vertical"></div>
</button>
Here you can see how the effect works and also the original code:
https://codepen.io/electerious/details/qPjbGm
How can I make this effect the other way round?
All you need to do is change where you use the transform.
.button__vertical {
transform: scaleY(0);
--horizontal-offset: calc(var(--offset) * -1);
border-left: var(--border-size) solid currentcolor;
border-right: var(--border-size) solid currentcolor;
}
.button:hover .button__vertical {
transform: scaleY(1);
}
With that its not visible and once you hover you scale it. you will obvs need to do the same for the button__horizontal class but for the scaleX
Here is an easier idea with less of code and only the button tag:
.button {
--offset: 10px;
--border-size: 2px;
padding: 1.5em 3em;
border: var(--offset) solid transparent;
appearance: none;
color: #e55743;
text-transform: uppercase;
letter-spacing: .25em;
cursor: pointer;
font-weight: bold;
--_g: currentColor var(--border-size),#0000 0 calc(100% - var(--border-size)),currentColor 0;
background:
linear-gradient(90deg,var(--_g)) 50%/calc(100% - 2*var(--offset)) 100% border-box,
linear-gradient( var(--_g)) 50%/100% calc(100% - 2*var(--offset)) border-box,
padding-box;
background-repeat: no-repeat;
clip-path: inset(var(--offset));
transition: .8s ease;
}
.button:hover {
background-color: rgba(100, 0, 0, .03);
clip-path: inset(0);
}
body {
display: grid;
place-content: center;
height: 100vh;
margin: 0;
background: #fcf3ec;
}
<button class="button">Fancy Button</button>

Creating a switch toggle with a "yes" "no" that appears inside

How do I create a switch toggle input where a "Y" and "N" appears 'above' the input?
In the snippet below, I have a problem where the z-index of the "Y" and "N" covers the input so it is only toggle-able if you click around the z-indexed spans.
Additionally, I would like the letters to change color when the checkbox is toggled, but that is a secondary issue, I think.
body, html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
.switch__input {
position: absolute;
top: 0;
left: 0;
width: 90px;
height: 50px;
opacity: 0;
z-index: 0;
}
.switch__label:before {
content: '';
text-align: center;
position: absolute;
color: red;
top: 5px;
left: 0;
width: 90px;
height: 35px;
background-color: rgba(0, 0, 0, 0.26);
border-radius: 100px;
z-index: 0;
-webkit-transition: background-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: background-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch__label:after {
content: '';
color: white;
position: absolute;
text-align: center;
font-size: 24px;
padding: 4.4px 0;
top: -2px;
left: 0;
width: 50px;
height: 50px;
background-color: #2d95e5;
border-radius: 100px;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
z-index: 0;
-webkit-transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
-webkit-transition-property: left, background-color;
transition-property: left, background-color;
}
.switch__input:checked + .switch__label:before {
background-color: rgba(225, 225, 225, 0.5);
}
.switch__input:checked + .switch__label:after {
left: 40px;
content: '';
color: white;
background-color: #BFBFBF;
}
.yesnocontainer {
font-family: sans-serif;
display: flex;
width: 70px;
justify-content: space-evenly;
align-content: center;
}
.yes, .no {
font-size: 24px;
}
.yes {
position: relative;
color: black !important;
z-index: 999 !important;
}
.no {
position: relative;
color: black !important;
z-index: 999 !important;
}
<div class="switch">
<input type="checkbox" id="switch1" class="switch__input" checked>
<label for="switch1" class="switch__label"></label>
<span class="yesnocontainer">
<span class="yes">Y</span>
<span class="no">N</span>
</span>
</div>
.switch-toggle {
float: left;
background: gray;
}
.switch-toggle input {
position: absolute;
opacity: 0;
}
.switch-toggle input + label {
padding: 7px;
float:left;
color: #fff;
cursor: pointer;
}
.switch-toggle input:checked + .red {
background: red;
}
.switch-toggle input:checked + .green {
background: green;
}
<div class="switch-toggle switch-3 switch-candy">
<input id="on" name="state-d" class="green" type="radio" />
<label for="on" class="green" onclick="">ON</label>
<input id="off" name="state-d" class="red" type="radio" />
<label for="off" class="red" onclick="">OFF</label>
</div>
.switch__label must be visibled on screen, try this.
body, html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
/* ADD .switch__label */
.switch__input,.switch__label {
position: absolute;
top: 0;
left: 0;
width: 90px;
height: 50px;
opacity: 0;
z-index: 0;
}
/*ADD*/
.switch__label{
z-index:2;
opacity:1;
}
.switch__label:before {
content: '';
text-align: center;
position: absolute;
color: red;
top: 5px;
left: 0;
width: 90px;
height: 35px;
background-color: rgba(0, 0, 0, 0.26);
border-radius: 100px;
z-index: 0;
-webkit-transition: background-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: background-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch__label:after {
content: '';
color: white;
position: absolute;
text-align: center;
font-size: 24px;
padding: 4.4px 0;
top: -2px;
left: 0;
width: 50px;
height: 50px;
background-color: #2d95e5;
border-radius: 100px;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
z-index: 0;
-webkit-transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
-webkit-transition-property: left, background-color;
transition-property: left, background-color;
}
.switch__input:checked + .switch__label:before {
background-color: rgba(225, 225, 225, 0.5);
}
.switch__input:checked + .switch__label:after {
left: 40px;
content: '';
color: white;
background-color: #BFBFBF;
}
.yesnocontainer {
font-family: sans-serif;
display: flex;
width: 70px;
justify-content: space-evenly;
align-content: center;
}
.yes, .no {
font-size: 24px;
}
.yes {
position: relative;
color: black !important;
z-index: 1;
}
/* ADD */
.switch__input:checked + .switch__label + .yesnocontainer > .no {
z-index:3;
}
.no {
position: relative;
color: black !important;
z-index: 1;
}
/* ADD */
.switch__input:not(:checked) + .switch__label + .yesnocontainer > .yes {
z-index:3;
}
<div class="switch">
<input type="checkbox" id="switch1" class="switch__input" checked>
<label for="switch1" class="switch__label"></label>
<span class="yesnocontainer">
<span class="yes">Y</span>
<span class="no">N</span>
</span>
</div>

Placing text inside range slider

I am new to CSS and have a question that is probably simple to answer, though I am not sure which class to start with.
My objective is to put text that fit neatly inside of range slider
I am using public range slider example:
let app = (() => {
function updateSlider(element) {
if (element) {
let parent = element.parentElement,
lastValue = parent.getAttribute('data-slider-value');
if (lastValue === element.value) {
return; // No value change, no need to update then
}
parent.setAttribute('data-slider-value', element.value);
let $thumb = parent.querySelector('.range-slider__thumb'),
$bar = parent.querySelector('.range-slider__bar'),
pct = element.value * ((parent.clientHeight - $thumb.clientHeight) / parent.clientHeight);
$thumb.style.bottom = `${pct}%`;
$bar.style.height = `calc(${pct}% + ${$thumb.clientHeight / 2}px)`;
$thumb.textContent = `${element.value}%`;
}
}
return {
updateSlider: updateSlider };
})();
(function initAndSetupTheSliders() {
const inputs = [].slice.call(document.querySelectorAll('.range-slider input'));
inputs.forEach(input => input.setAttribute('value', '50'));
inputs.forEach(input => app.updateSlider(input));
// Cross-browser support where value changes instantly as you drag the handle, therefore two event types.
inputs.forEach(input => input.addEventListener('input', element => app.updateSlider(input)));
inputs.forEach(input => input.addEventListener('change', element => app.updateSlider(input)));
})();
.range-slider {
position: relative;
text-align: center;
height: 300px;
max-height: 100%;
margin-top: 15%;
/*margin-bottom: 5vh;*/
}
/*.range-slider:before {
position: absolute;
top: -2em;
//left: .5em;
content: attr(data-slider-value) "%";
color: red;
font-size: 25px;
}*/
.range-slider__thumb {
position: absolute;
left: 32%;
width: 45px;
height: 45px;
line-height: 45px;
font-weight: bold;
background: white;
color: black;
background: url('../../../assets/images/button_round_dark.png');
font-size: 80%;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9);
border-radius: 50%;
pointer-events: none;
z-index:999;
// position: absolute;
// left: 42%;
// width: 30px;
// height: 30px;
// line-height: 30px;
// background: white;
// color: black;
// font-size: 50%;
// font-size: 80%;
// box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9);
// border-radius: 50%;
// pointer-events: none;
// z-index:999;
}
.range-slider__thumb_start{
position: absolute;
left: 33%;
width: 45px;
height: 45px;
line-height: 30px;
background: white;
color: black;
background: url('../../../assets/images/button_round_dark.png');
font-size: 60%;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9);
border-radius: 50%;
pointer-events: none;
z-index:99;
bottom: 0px;
}
.range-slider__bar {
left: 42%;
bottom: 0;
position: absolute;
background: linear-gradient(to bottom, #c00000 0%, #ffe200 100%);
pointer-events: none;
width: 20px;
border-radius: 10px;
}
.range-slider input[type=range][orient=vertical] {
position: relative;
margin: 0;
height: 100%;
width: 100%;
display: inline-block;
position: relative;
writing-mode: bt-lr;
-webkit-appearance: slider-vertical;
}
.range-slider input[type=range][orient=vertical]::-webkit-slider-runnable-track, .range-slider input[type=range][orient=vertical]::-webkit-slider-thumb {
-webkit-appearance: none;
}
.range-slider input[type=range][orient=vertical]::-webkit-slider-runnable-track {
border: none;
background: orangered;
width: 18px;
border-color: #B94F1B;
border-radius: 10px;
//box-shadow: 0 0 0 20px rgba(96, 96, 96, 0.1);
//-webkit-box-shadow: 5px 38px 0px 53px rgba(0,0,0,0.35);
//-moz-box-shadow: 5px 38px 0px 53px rgba(0,0,0,0.35);
box-shadow: 0px 20px 0px 40px rgba(96, 96, 96, 0.1);
}
.range-slider input[type=range][orient=vertical]::-moz-range-track {
border: none;
background: white;
width: 18px;
border-color: #343440;
border-radius: 10px;
//box-shadow: 0 0 0 2px #3D3D4A;
}
.range-slider input[type=range][orient=vertical]::-ms-track {
border: none;
background: white;
width: 18px;
border-color: #343440;
border-radius: 10px;
box-shadow: 0 0 0 2px #3D3D4A;
color: transparent;
height: 100%;
}
.range-slider input[type=range][orient=vertical]::-ms-fill-lower, .range-slider input[type=range][orient=vertical]::-ms-fill-upper, .range-slider input[type=range][orient=vertical]::-ms-tooltip {
display: none;
}
.range-slider input[type=range][orient=vertical]::-webkit-slider-thumb {
width: 30px;
height: 30px;
opacity: 0;
}
.range-slider input[type=range][orient=vertical]::-moz-range-thumb {
width: 30px;
height: 30px;
opacity: 0;
}
.range-slider input[type=range][orient=vertical]::-ms-thumb {
width: 30px;
height: 30px;
opacity: 0;
}
.range-slider-text{
font-size: 1rem;
color: red;
text-transform: uppercase;
letter-spacing: 3px;
position: absolute;
bottom: 0;
left: 0;
margin-left: -30px;
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
-webkit-transform-origin: 0 0;
-moz-transform-origin: 0 0;
-ms-transform-origin: 0 0;
-o-transform-origin: 0 0;
transform-origin: 0 0;
}
<div class="range-slider" id="range_slider">
<input type="range" orient="vertical" id="desire" name="desire" min="{{min}}" max="{{max}}" />
<div class="range-slider__bar"></div>
<div class="range-slider-text">Header Two</div>
<div class="range-slider__thumb"></div>
<div class="bubble" id="me" style="display: none">slide to provide your feedback</div>
<!-- <div class="range-slider__thumb_start"></div> -->
<div class="range-slider__line"></div>
</div>
I am new to CSS and have a question that is probably simple to answer, though I am not sure which class to start with.
My objective is to put text that fit neatly inside of range slider
I am using public range slider example:
Like
I just update your code with few CSS and HTML changes, I hope it'll help you out. Thanks
Add display: flex;, justify-content: center; and align-items: center CSS in .range-slider__bar.
.range-slider__bar {
left: 42%;
bottom: 0;
position: absolute;
background: linear-gradient(to bottom, #c00000 0%, #ffe200 100%);
pointer-events: none;
width: 20px;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
}
Also, add slider-text css.
.slider-text {
transform: rotate(-90deg);
white-space: nowrap;
}
In HTML i just add <div class="slider-text">My Desire</div> inside of your <div class="range-slider__bar">.
let app = (() => {
function updateSlider(element) {
if (element) {
let parent = element.parentElement,
lastValue = parent.getAttribute('data-slider-value');
if (lastValue === element.value) {
return; // No value change, no need to update then
}
parent.setAttribute('data-slider-value', element.value);
let $thumb = parent.querySelector('.range-slider__thumb'),
$bar = parent.querySelector('.range-slider__bar'),
pct = element.value * ((parent.clientHeight - $thumb.clientHeight) / parent.clientHeight);
$thumb.style.bottom = `${pct}%`;
$bar.style.height = `calc(${pct}% + ${$thumb.clientHeight / 2}px)`;
$thumb.textContent = `${element.value}%`;
}
}
return {
updateSlider: updateSlider };
})();
(function initAndSetupTheSliders() {
const inputs = [].slice.call(document.querySelectorAll('.range-slider input'));
inputs.forEach(input => input.setAttribute('value', '50'));
inputs.forEach(input => app.updateSlider(input));
// Cross-browser support where value changes instantly as you drag the handle, therefore two event types.
inputs.forEach(input => input.addEventListener('input', element => app.updateSlider(input)));
inputs.forEach(input => input.addEventListener('change', element => app.updateSlider(input)));
})();
.range-slider {
position: relative;
text-align: center;
height: 300px;
max-height: 100%;
margin-top: 15%;
/*margin-bottom: 5vh;*/
}
/*.range-slider:before {
position: absolute;
top: -2em;
//left: .5em;
content: attr(data-slider-value) "%";
color: red;
font-size: 25px;
}*/
.range-slider__thumb {
position: absolute;
left: 32%;
width: 45px;
height: 45px;
line-height: 45px;
font-weight: bold;
background: white;
color: black;
background: url('../../../assets/images/button_round_dark.png');
font-size: 80%;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9);
border-radius: 50%;
pointer-events: none;
z-index:999;
// position: absolute;
// left: 42%;
// width: 30px;
// height: 30px;
// line-height: 30px;
// background: white;
// color: black;
// font-size: 50%;
// font-size: 80%;
// box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9);
// border-radius: 50%;
// pointer-events: none;
// z-index:999;
}
.range-slider__thumb_start{
position: absolute;
left: 33%;
width: 45px;
height: 45px;
line-height: 30px;
background: white;
color: black;
background: url('../../../assets/images/button_round_dark.png');
font-size: 60%;
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.9);
border-radius: 50%;
pointer-events: none;
z-index:99;
bottom: 0px;
}
.range-slider__bar {
left: 42%;
bottom: 0;
position: absolute;
background: linear-gradient(to bottom, #c00000 0%, #ffe200 100%);
pointer-events: none;
width: 20px;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
}
.slider-text {
transform: rotate(-90deg);
white-space: nowrap;
}
.range-slider input[type=range][orient=vertical] {
position: relative;
margin: 0;
height: 100%;
width: 100%;
display: inline-block;
position: relative;
writing-mode: bt-lr;
-webkit-appearance: slider-vertical;
}
.range-slider input[type=range][orient=vertical]::-webkit-slider-runnable-track, .range-slider input[type=range][orient=vertical]::-webkit-slider-thumb {
-webkit-appearance: none;
}
.range-slider input[type=range][orient=vertical]::-webkit-slider-runnable-track {
border: none;
background: orangered;
width: 18px;
border-color: #B94F1B;
border-radius: 10px;
//box-shadow: 0 0 0 20px rgba(96, 96, 96, 0.1);
//-webkit-box-shadow: 5px 38px 0px 53px rgba(0,0,0,0.35);
//-moz-box-shadow: 5px 38px 0px 53px rgba(0,0,0,0.35);
box-shadow: 0px 20px 0px 40px rgba(96, 96, 96, 0.1);
}
.range-slider input[type=range][orient=vertical]::-moz-range-track {
border: none;
background: white;
width: 18px;
border-color: #343440;
border-radius: 10px;
//box-shadow: 0 0 0 2px #3D3D4A;
}
.range-slider input[type=range][orient=vertical]::-ms-track {
border: none;
background: white;
width: 18px;
border-color: #343440;
border-radius: 10px;
box-shadow: 0 0 0 2px #3D3D4A;
color: transparent;
height: 100%;
}
.range-slider input[type=range][orient=vertical]::-ms-fill-lower, .range-slider input[type=range][orient=vertical]::-ms-fill-upper, .range-slider input[type=range][orient=vertical]::-ms-tooltip {
display: none;
}
.range-slider input[type=range][orient=vertical]::-webkit-slider-thumb {
width: 30px;
height: 30px;
opacity: 0;
}
.range-slider input[type=range][orient=vertical]::-moz-range-thumb {
width: 30px;
height: 30px;
opacity: 0;
}
.range-slider input[type=range][orient=vertical]::-ms-thumb {
width: 30px;
height: 30px;
opacity: 0;
}
.range-slider-text{
font-size: 1rem;
color: red;
text-transform: uppercase;
letter-spacing: 3px;
position: absolute;
bottom: 0;
left: 0;
margin-left: -30px;
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
-webkit-transform-origin: 0 0;
-moz-transform-origin: 0 0;
-ms-transform-origin: 0 0;
-o-transform-origin: 0 0;
transform-origin: 0 0;
}
<div class="range-slider" id="range_slider">
<input type="range" orient="vertical" id="desire" name="desire" min="{{min}}" max="{{max}}" />
<div class="range-slider__bar">
<div class="slider-text">My Desire</div>
</div>
<div class="range-slider-text">Header Two</div>
<div class="range-slider__thumb"></div>
<div class="bubble" id="me" style="display: none">slide to provide your feedback</div>
<!-- <div class="range-slider__thumb_start"></div> -->
<div class="range-slider__line"></div>
</div>

The video element is not showing on the page

Recently I used app.js as the framework to design the layout of my web app. The web app is to stream from webcam and show on the webpage html video element.
The webcam is working and running, however the video doesn't show on my webpage, in fact the whole video element like being hidden underneath something.
Could anyone point to me where is my error? at first I though it is about the z-index of the elements, but I couldn't solve it,so it might not be the case.
I will attach snippets of my html and Css files below.
thanks in advance
HTML:
<!DOCTYPE html>
<html>
<head>
<title>PasarOnline</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="../appjsFile/app.min.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="manifest" href="../manifest.json">
<!-- Add to home screen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="PasarOnline">
<link rel="apple-touch-icon" href="../images/icons/icon-152x152.png">
<meta name="msapplication-TileImage" content="../images/icons/icon-144x144.png">
<meta name="msapplication-TileColor" content="#2F3BA2">
<style>
.navbar {
background-color: #000;
overflow: hidden;
position: fixed;
bottom: 0;
width: 100%;
z-index: 3000;
}
/* Style the links inside the navigation bar */
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
.navbar a:hover {
background-color: #ddd;
color: black;
}
.navbar a.active {
background-color: #4CAF50;
color: white;
}
.navbar .icon {
display: none;
}
.form-popup {
display: none;
position: fixed;
bottom: 0;
right: 15px;
border: 3px solid #f1f1f1;
z-index: 1001;
}
.form-container {
max-width: 300px;
padding: 10px;
background-color: white;
}
/* Full-width input fields */
.form-container input[type=text],
input[type=number] {
width: 100%;
padding: 15px;
margin: 5px 0 10px 0;
border: none;
background: #f1f1f1;
}
.form-container input[type=text]:focus {
background-color: #ddd;
outline: none;
}
.form-container .btn {
background-color: #4CAF50;
color: white;
padding: 16px 20px;
border: none;
cursor: pointer;
width: 40%;
margin-left: 10px;
margin-bottom: 10px;
opacity: 0.8;
}
.form-container .cancel {
background-color: red;
}
.centerVideo {
margin: 0 auto;
display: block;
position: relative;
width: 350px;
margin-top: 20px;
}
b {
margin: 0 auto;
}
hr {
margin-top: 32px;
}
.bottom1 {
margin-bottom: 16px;
margin: 0 auto;
}
.card {
/* Add shadows to create the "card" effect */
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.container {
padding: 2px 16px;
}
.semi-square {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.wrap {
right: 0;
width: 0 auto;
left: 0;
margin: 16px auto;
}
/* select starting stylings ------------------------------*/
.select {
font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
position: relative;
width: 350px;
margin-top: 20px;
}
.select-text {
position: relative;
font-family: inherit;
background-color: transparent;
width: 350px;
padding: 10px 10px 10px 0;
font-size: 18px;
border-radius: 0;
border: none;
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
/* Remove focus */
.select-text:focus {
outline: none;
border-bottom: 1px solid rgba(0, 0, 0, 0);
}
/* Use custom arrow */
.select .select-text {
appearance: none;
-webkit-appearance: none
}
.select:after {
position: absolute;
top: 18px;
right: 10px;
/* Styling the down arrow */
width: 0;
height: 0;
padding: 0;
content: '';
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid rgba(0, 0, 0, 0.12);
pointer-events: none;
}
/* LABEL ======================================= */
.select-label {
color: rgba(0, 0, 0, 0.26);
font-size: 18px;
font-weight: normal;
position: absolute;
pointer-events: none;
left: 0;
top: 10px;
transition: 0.2s ease all;
}
/* active state */
.select-text:focus~.select-label,
.select-text:valid~.select-label {
color: #228B22;
top: -5px;
transition: 0.2s ease all;
font-size: 14px;
}
/* BOTTOM BARS ================================= */
.select-bar {
position: relative;
display: block;
width: 350px;
}
.select-bar:before,
.select-bar:after {
content: '';
height: 2px;
width: 0;
bottom: 1px;
position: absolute;
background: #228B22;
transition: 0.2s ease all;
}
.select-bar:before {
left: 50%;
}
.select-bar:after {
right: 50%;
}
/* active state */
.select-text:focus~.select-bar:before,
.select-text:focus~.select-bar:after {
width: 50%;
}
/* HIGHLIGHTER ================================== */
.select-highlight {
position: absolute;
height: 60%;
width: 100px;
top: 25%;
left: 0;
pointer-events: none;
opacity: 0.5;
}
.center {
margin: 0 auto;
}
</style>
</head>
<body>
<div class="app-page" data-page="addItemPage">
<div class="app-topbar">
<div class="app-title">Add Item Page</div>
</div>
<div class="app-content">
<div class="app-section">
<h1>Scan Item Barcode:</h1>
<div class="card" >
<video muted playsinline id="qr-video" width="60%" height="60%" class="centerVideo">Video not showing</video>
</div>
<div class="select">
<select id="inversion-mode-select" class="select-text">
<option value="original" selected="original">Scan original</option>
<option value="invert">Scan with inverted colors</option>
<option value="both">Scan both</option>
</select>
<label class="select-label"><b>Select Barcode Type:</b></label>
<span class="select-highlight"></span>
<span class="select-bar"></span>
<br>
</div>
</div>
</div>
</div>
<div class="app-page" data-page="deleteItemPage">
<div class="app-topbar">
<div class="app-button left" data-back data-autotitle></div>
<div class="app-title">Delete Item</div>
</div>
<div class="app-content">
Page 2 is delete item
</div>
</div>
<div class="app-page" data-page="listItemPage">
<div class="app-topbar">
<div class="app-button left" data-back data-autotitle></div>
<div class="app-title">List Item</div>
</div>
<div class="app-content">
Page 3 is list item
</div>
</div>
<div class="form-popup" id="myForm">
<form action="/action_page.php" class="form-container">
<h1>Add Item</h1>
<b>Serial</b>
<input type="number" placeholder="Enter Serial Number" name="vSerial" id="vSerialID" required>
<b>Veggie Name</b>
<input type="text" placeholder="Enter Veggie Name" name="vName" required>
<b>Weight</b>
<input type="number" placeholder="Enter Weight(KG)" name="vWeight" required>
<div align="center">
<button type="submit" class="btn">Add Item</button>
<span><button type="button" class="btn cancel" id="closeBut">Close</button></span>
</div>
</form>
</div>
<div class="navbar" id="bottomNavbar">
Add Item
Delete Item
List Item
</div>
<script src="../appjsFile/zepto.js"></script>
<script src="../appjsFile/app.min.js"></script>
<script type="module">
import QrScanner from "../qr-scanner.min.js";
QrScanner.WORKER_PATH = '../qr-scanner-worker.min.js';
const video = document.getElementById('qr-video');
// const camHasCamera = document.getElementById('cam-has-camera');
const camQrResult = document.getElementById('cam-qr-result');
const closeFormButton = document.getElementById('closeBut');
const deleteBut = document.getElementById("deleteItemBut");
const addBut = document.getElementById("addItemBut");
const listBut = document.getElementById("listItemBut");
const scanner = new QrScanner(video, result => setResult(camQrResult, result));
scanner.start();
App.controller('addItemPage', function(page) {
// put stuff here
});
App.controller('deleteItemPage', function(page) {
// put stuff here
});
App.controller('listItemPage', function(page) {
// put stuff here
});
deleteBut.addEventListener("click", function() {
App.load('deleteItemPage');
});
addBut.addEventListener("click", function() {
App.load('addItemPage');
});
listBut.addEventListener("click", function() {
App.load('listItemPage');
});
closeFormButton.addEventListener("click",closeForm);
// QRManualBut.addEventListener('click',function(){
// document.getElementById("myForm").style.display = "block";
// });
//########## check result #############//
function setResult(label, result) {
openForm(result);
label.textContent = result;
label.style.color = 'teal';
clearTimeout(label.highlightTimeout);
label.highlightTimeout = setTimeout(() => label.style.color = 'inherit', 100);
}
// ####### Web Cam Scanning #######//
document.getElementById('inversion-mode-select').addEventListener('change', event => {
scanner.setInversionMode(event.target.value);
});
//################pop up form ###########//
function openForm(serialNum) {
document.getElementById("myForm").style.display = "block";
document.getElementById("vSerialID").value = serialNum;
}
function closeForm() {
document.getElementById("myForm").style.display = "none";
}
//##########install pop up in homescreen########//
// if (location.protocol != 'https:')
// {
// location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
// }
try {
App.restore();
} catch (err) {
App.load('addItemPage');
}
</script>
</body>
</html>
app.min.css:
html,
body,
div,
form,
p,
ul,
li,
span,
label,
img {
margin: 0;
padding: 0;
outline: 0
}
html,
body {
height: 100%;
width: 100%
}
body {
position: relative;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
overflow: hidden
}
.app-android {
font-family: "Roboto", sans-serif
}
.app-no-scrollbar ::-webkit-scrollbar {
height: 0 !important;
width: 0 !important
}
* {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
tap-highlight-color: rgba(0, 0, 0, 0) !important
}
.clear {
clear: both
}
.app-android .app-ios-only,
.app-ios .app-android-only {
display: none
}
.app-clickblocker {
z-index: 9000;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #FFF;
opacity: 0
}
.app-page {
display: none;
position: relative;
height: 100%;
width: 100%;
overflow: hidden
}
.app-loaded .app-page {
display: block
}
.app-ios-7 .app-page,
.app-ios-8 .app-page {
box-shadow: 0 0 12px rgba(0, 0, 0, 0.2)
}
.app-topbar {
z-index: 3000;
position: relative;
height: 44px;
width: 100%;
background-color: #000;
color: #FFF;
-webkit-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.15);
box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.15)
}
.app-android .app-topbar {
height: 56px;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3)
}
.app-topbar .app-button {
position: absolute;
bottom: 0;
padding: 0 16px;
height: 100%;
line-height: 44px
}
.app-android .app-topbar .app-button {
line-height: 56px
}
.app-topbar .app-button.left {
left: 0
}
.app-topbar .app-button.right {
right: 0
}
.app-topbar .app-title {
margin: 0 auto;
height: 100%;
width: 100%;
line-height: 44px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap
}
.app-android .app-topbar .app-title {
line-height: 56px
}
.app-ios-statusbar .app-topbar {
padding-top: 20px
}
.app-android-statusbar .app-topbar {
padding-top: 24px
}
.app-android-statusbar .app-topbar:before {
position: absolute;
top: 0;
height: 24px;
width: 100%;
background-color: rgba(0, 0, 0, 0.3);
content: ""
}
.app-ios-statusbar .app-topbar .app-button {
height: 44px
}
.app-android-statusbar .app-topbar .app-button {
height: 56px
}
.app-content {
z-index: 2000;
position: relative;
background-color: #FFF;
overflow: auto;
-webkit-box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 12px rgba(0, 0, 0, 0.2)
}
.app-android-2 .app-content {
-webkit-box-shadow: none;
box-shadow: none
}
.app-scrollhack>* {
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
.app-section {
position: relative;
margin: 8px;
border: 1px solid #AAA
}
.app-list {
list-style: none
}
.app-list>li,
.app-list>li.app-button {
padding-left: 20px;
padding-right: 8px;
height: 43px;
border-bottom: 1px solid #AAA;
line-height: 43px;
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
white-space: nowrap
}
.app-android .app-list>li,
.app-android .app-list>li.app-button {
padding-top: 2px;
padding-bottom: 2px
}
.app-section .app-list>li:last-child,
.app-section .app-list>li.app-button:last-child {
border-bottom: 0
}
.app-list>label {
display: block;
padding-left: 12px;
height: 24px;
background-color: #000;
color: #FFF;
line-height: 24px
}
.app-list>li+label {
margin-top: -1px
}
.app-content .app-button {
margin: 0 auto;
height: 40px;
border-bottom: 1px solid #AAA;
line-height: 40px;
overflow: hidden;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap
}
.app-button:last-child {
border-bottom: 0
}
.app-content .app-button.green {
background-color: #7F7
}
.app-content .app-button.red {
background-color: #F77
}
.app-content .app-button.blue {
background-color: #77F
}
.app-topbar.teal {
background-color: #2B9;
color: #f3f4f5
}
.app-topbar.green {
background-color: #3C7;
color: #f3f4f5
}
.app-topbar.yellow {
background-color: #EC1;
color: #f3f4f5
}
.app-topbar.orange {
background-color: #E82;
color: #f3f4f5
}
.app-topbar.red {
background-color: #dd4539;
color: #f3f4f5
}
.app-topbar.blue {
background-color: #4486f0;
color: #f3f4f5
}
.app-topbar.dark-blue {
background-color: #345;
color: #f3f4f5
}
.app-topbar .app-title {
font-size: 17px;
font-weight: 500
}
.app-android .app-topbar .app-title {
float: left;
padding-left: 15px;
padding-right: 8px;
width: auto;
font-size: 19px;
font-weight: 700;
text-align: left
}
.app-android .app-topbar .app-button.left~.app-title {
padding-left: 60px
}
.app-topbar .app-button {
font-weight: 300;
-webkit-transition: opacity .25s ease-out;
transition: opacity .25s ease-out
}
.app-android .app-topbar .app-button {
padding: 0 13px;
font-weight: 400;
-webkit-transition: background-color .25s ease-out;
transition: background-color .25s ease-out
}
.app-topbar .app-button.active {
opacity: .65
}
.app-android .app-topbar .app-button.active {
opacity: 1;
background-color: rgba(0, 0, 0, 0.2)
}
.app-topbar .app-button.active,
.app-android .app-topbar .app-button.active,
.app-android-2 .app-topbar .app-button,
.app-android-4 .app-topbar .app-button {
-webkit-transition: none;
transition: none
}
.app-topbar .app-button[data-back].left {
padding: 15px 0 15px 27px;
height: 14px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAoCAYAAADkDTpVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAxJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RUQxQ0FCN0VGMjJGMTFFMjg0REFDNDBBRUVBRjJBNDkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RUQxQ0FCN0RGMjJGMTFFMjg0REFDNDBBRUVBRjJBNDkiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiBNYWNpbnRvc2giPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0iNTNBQzg4QkE2OTc3M0MxNDg4ODc1M0VDNzc3ODcwMDUiIHN0UmVmOmRvY3VtZW50SUQ9IjUzQUM4OEJBNjk3NzNDMTQ4ODg3NTNFQzc3Nzg3MDA1Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dT5F6gAAAcNJREFUeNqslz8sA1Ecx+9UKi1ispkwMAgbs5XYTCJhlLB3uxrETsLGUgMbutaqJg0Jg5pqqqVCm1TaPt+X3ONp7n53fb/3kk/Su8v7fq/v3u/Pc4UQjsWRAQNg9/eONLDEtvgbnrpvS3wDdMT/4dkyWAUtETy8PuaaL4EcSIQ8T3HefBHURfg4Bq6p+Dz4JMTPQML0G8yCGiF+BZKmu2gKVAnxG5DW5/QiPg4qhPgdGOmeF1d8DJQJ8UcwGjQ3jric+ESIl/0XcEwM5F++J8TfwCSlQYkPgltC/B3MRK1A2IMUKBDiH34sOCYGcg9fE+INP4odEwMZfeeE+DdY6SV29AsXnBDibbDWa+TrFweCHlsmeUv92IsQz5hm3bj1wLxwx1yiDneJ1Ec+JUxa3I+stukFYdLkbFM90PKESZ0TaIp0RKqocVKFYggUCZMqJ9np6bpEmFQ46VovOM+EyQun4Ogl85UweeCUTMVERNEvcoq+YjqibSlw2hbFXETjdclpvBQL4IswyXFaR735bRAmR5zmV7Hs56ewsc89H+TBOmiHPG/aOkJtBhyhsjbPaJKdbnFJv8Uj7CEYBkmQVTd/BBgAAQDbZCXVLesAAAAASUVORK5CYII=);
background-repeat: no-repeat;
-webkit-background-size: 12px 20px;
background-size: 12px 20px;
background-position: 8px center;
line-height: 14px
}
.app-android .app-topbar .app-button[data-back].left {
padding: 0 16px;
height: 56px;
width: 24px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAABCRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIgogICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgICAgICAgICAgIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjU8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjcyPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlvbj43MjwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjcyPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6Q29sb3JTcGFjZT4xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj43MjwvZXhpZjpQaXhlbFlEaW1lbnNpb24+CiAgICAgICAgIDxkYzpzdWJqZWN0PgogICAgICAgICAgICA8cmRmOkJhZy8+CiAgICAgICAgIDwvZGM6c3ViamVjdD4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTU6MDI6MTMgMjI6MDI6MzU8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wOkNyZWF0b3JUb29sPlBpeGVsbWF0b3IgMy4zLjE8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+ChTTdgYAAAF3SURBVHgB7dtBCsIwFIRh69o7eAhdiQdw53U9gFsP4dqt4LK+QANF6Dgp1FbyCyXCG2nz8aKQ1tWKFwIIIIAAAggggAACCCCAQNUCbdte0lE1wtDkO5xnjOkAqQ/1gQOSgbMYpHX/Yn/9vltKR3HeXWS2oj55aTYgA+cVsz83TXOfXGFpJxj4zsnLKo2POA5Lu+6fXA84ghkccISAKNE54AgBUaJzwBECokTngCMERInOAUcIiBKdA44QEKUaOqcR85elhBMBtdklPz9XMfaXNiXnHrVh9q84JTA5WwxUE05CKgbKsrWMxUCxhk+BcwVICNSGJCh0qYafeS1gVEECyRAwInQSSIaAEaGTQDIEjAidBJIhYEToJJAMASNCJ4FkCBgROgkkQ8CI/Esnjb6rYRh8jSSkCKk7I+lJ1/2cT7oWb7l+nXVBwNiZvM2JUzCVaaMDy43/a/TZP5DA6ePk9x0SOBmEEQEEEEAAAQQQQAABBBCoVOANecdGRmb5/CMAAAAASUVORK5CYII=);
-webkit-background-size: 24px 24px;
background-size: 24px 24px;
background-position: center;
color: transparent
}
.app-android .app-topbar>:last-child:after {
content: "";
clear: both
}
.app-page,
.app-content {
background-color: #efeff4
}
.app-section,
.app-list>li,
.app-list>li.app-button,
.app-content .app-button,
.app-input {
border: 0
}
.app-section {
margin: 16px;
padding: 8px;
background: #FFF;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
-webkit-border-radius: 6px;
border-radius: 6px
}
.app-ios-7 .app-section,
.app-ios-8 .app-section {
border-bottom: 0
}
.app-section.app-button {
margin: 16px;
padding: 0
}
p.app-section {
padding: 12px 16px;
color: #665
}
.app-content .app-section>* {
margin: 8px 0 0;
-webkit-border-radius: 4px;
border-radius: 4px
}
.app-content .app-section>:first-child {
margin-top: 0
}
.app-list>label {
height: 28px;
background-color: #d5e5e6;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #778;
font-size: 14px;
font-weight: 600;
line-height: 28px
}
.app-android .app-list>label {
font-size: 11px;
font-weight: 700;
text-transform: uppercase
}
.app-list>li {
background-color: #FFF;
color: #444
}
.app-list>li,
.app-list>li.app-button {
border-top: 1px solid rgba(0, 0, 0, 0.05);
-webkit-box-sizing: border-box;
box-sizing: border-box
}
.app-android .app-list>li,
.app-android .app-list>li.app-button {
padding-top: 0;
padding-bottom: 0;
height: 47px;
line-height: 47px
}
.app-list>li.app-button.active {
border-top: 1px solid rgba(0, 0, 0, 0.0)
}
.app-list>li:first-child,
.app-list>li.app-button:first-child,
.app-list>label+li,
.app-list>label+li.app-button,
.app-list>label+li.app-button.active,
.app-list>li.app-button.active+li,
.app-list>li.app-button.active+li.app-button {
border-top-color: transparent
}
.app-input[type="search"].no-icon,
.app-android .app-input[type="search"].no-icon-android,
.app-ios .app-input[type="search"].no-icon-ios {
padding-left: 12px;
background-image: none
}
You can check this blog post regarding accessing the webcam in html5.
Here is the basic code for this:
HTML file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="stuff, to, help, search, engines, not" name="keywords">
<meta content="What this page is about." name="description">
<meta content="Display Webcam Stream" name="title">
<title>Display Webcam Stream</title>
<style>
#container {
margin: 0px auto;
width: 500px;
height: 375px;
border: 10px #333 solid;
}
#videoElement {
width: 500px;
height: 375px;
background-color: #666;
}
</style>
</head>
<body>
<div id="container">
<video autoplay="true" id="videoElement">
</video>
</div>
<script>
</script>
</body>
</html>
JS file:
var video = document.querySelector("#videoElement");
if (navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({video: true})
.then(function(stream) {
video.srcObject = stream;
})
.catch(function(err0r) {
console.log("Something went wrong!");
});
}
Try and implement the following using the getUserMedia method. All we are telling getUserMedia is to specify a constraints object whose video property is set to true. This means that default settings will be used in capturing the visuals and displaying them.

CSS button not aligning correctly

I have made this button by editing "Simple Hover Effect by Vincent Durand". But the problem is that some css in my blog is overlapping. So it is not aligning to middle correctly. I cant find which one it may be. I tried using !important tag in some places. But I guess it didn't work out. What I need to know where should I use !important in this code to align the button to middle? Or will I need a new css element to do that?
<!-- Awesome button css Start -->
.btn-margin {
margin-top: 1.6rem;
box-sizing: inherit;
text-align: center;
}
.btn {
-webkit-tap-high!importantr: transparent;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.14) 0 3px 3px 0, rgba(0, 0, 0, 0.12) 0 1px 7px 0, rgba(0, 0, 0, 0.2) 0 3px 1px -1px;
box-sizing: inherit;
color: white !important;
cursor: pointer;
display: inline-block;
height: auto;
letter-spacing: 0.5px;
line-height: 42px;
pointer-events: all;
position: relative;
text-decoration-line: none;
vertical-align: middle;
font-size: 1.6em;
padding: 0 2em;
transition: 800ms ease all;
}
.btn-green {
background-color: #1AAB8A;
}
.btn-green:hover {
background-color: #fff;
color: #1AAB8A !important;
}
.btn:before,.btn:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 2px;
width: 0;
transition: 400ms ease all;
}
.btn:after {
right: inherit;
top: inherit;
left: 0;
bottom: 0;
}
.btn-green:before,.btn-green:after {
background: #1AAB8A;
}
.btn:hover:before,.btn:hover:after {
width: 100%;
transition: 800ms ease all;
}
<!-- Awesome button css End -->
<div class="btn-margin">
<a class="btn btn-green" href="#">
Click Here To See Answers
</a>
</div>
Add *{box-sizing:border-box;} to ur css
<!-- Awesome button css Start -->
*{box-sizing:border-box;}
.btn-margin {
margin-top: 1.6rem;
box-sizing: inherit;
text-align: center;
}
.btn {
-webkit-tap-high!importantr: transparent;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.14) 0 3px 3px 0, rgba(0, 0, 0, 0.12) 0 1px 7px 0, rgba(0, 0, 0, 0.2) 0 3px 1px -1px;
box-sizing: inherit;
color: white !important;
cursor: pointer;
display: inline-block;
height: auto;
letter-spacing: 0.5px;
line-height: 42px;
pointer-events: all;
position: relative;
text-decoration-line: none;
vertical-align: middle;
font-size: 1.6em;
padding: 0 2em;
transition: 800ms ease all;
}
.btn-green {
background-color: #1AAB8A;
}
.btn-green:hover {
background-color: #fff;
color: #1AAB8A !important;
}
.btn:before,.btn:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 2px;
width: 0;
transition: 400ms ease all;
}
.btn:after {
right: inherit;
top: inherit;
left: 0;
bottom: 0;
}
.btn-green:before,.btn-green:after {
background: #1AAB8A;
}
.btn:hover:before,.btn:hover:after {
width: 100%;
transition: 800ms ease all;
}
<!-- Awesome button css End -->
<div class="btn-margin">
<a class="btn btn-green" href="#">
Click Here To See Answers
</a>
</div>
Use this CSS to center align the button
.btn-green {
background-color: #1AAB8A;
position: relative;
left: 50%;
transform: translateX(-50%);
}
<!-- Awesome button css Start -->.btn-margin {
margin-top: 1.6rem;
box-sizing: inherit;
position: relative;
left: 50%;
transform: translateX(-50%);
}
.btn {
-webkit-tap-high!importantr: transparent;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.14) 0 3px 3px 0, rgba(0, 0, 0, 0.12) 0 1px 7px 0, rgba(0, 0, 0, 0.2) 0 3px 1px -1px;
box-sizing: inherit;
color: white !important;
cursor: pointer;
display: inline-block;
height: auto;
letter-spacing: 0.5px;
line-height: 42px;
pointer-events: all;
position: relative;
text-decoration-line: none;
vertical-align: middle;
font-size: 1.6em;
padding: 0 2em;
transition: 800ms ease all;
}
.btn-green {
background-color: #1AAB8A;
position: relative;
left: 50%;
transform: translateX(-50%);
}
.btn-green:hover {
background-color: #fff;
color: #1AAB8A !important;
}
.btn:before,
.btn:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 2px;
width: 0;
transition: 400ms ease all;
}
.btn:after {
right: inherit;
top: inherit;
left: 0;
bottom: 0;
}
.btn-green:before,
.btn-green:after {
background: #1AAB8A;
}
.btn:hover:before,
.btn:hover:after {
width: 100%;
transition: 800ms ease all;
}
<!-- Awesome button css End -->.btn-green {}
<div class="btn-margin">
<a class="btn btn-green" href="https://myneobuxportal.blogspot.com/p/answer-gamer-quiz-v2.html">
Click Here To See Answers
</a>
</div>
add one parent div and set this div text-align: center;
<!-- Awesome button css Start -->
.demo{
text-align: center;
}
.btn-margin {
margin-top: 1.6rem;
box-sizing: inherit;
text-align: center;
}
.btn {
-webkit-tap-high!importantr: transparent;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.14) 0 3px 3px 0, rgba(0, 0, 0, 0.12) 0 1px 7px 0, rgba(0, 0, 0, 0.2) 0 3px 1px -1px;
box-sizing: inherit;
color: white !important;
cursor: pointer;
display: inline-block;
height: auto;
letter-spacing: 0.5px;
line-height: 42px;
pointer-events: all;
position: relative;
text-decoration-line: none;
vertical-align: middle;
font-size: 1.6em;
padding: 0 2em;
transition: 800ms ease all;
}
.btn-green {
background-color: #1AAB8A;
}
.btn-green:hover {
background-color: #fff;
color: #1AAB8A !important;
}
.btn:before,.btn:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 2px;
width: 0;
transition: 400ms ease all;
}
.btn:after {
right: inherit;
top: inherit;
left: 0;
bottom: 0;
}
.btn-green:before,.btn-green:after {
background: #1AAB8A;
}
.btn:hover:before,.btn:hover:after {
width: 100%;
transition: 800ms ease all;
}
<!-- Awesome button css End -->
<div class="Demo">
<div class="btn-margin">
<a class="btn btn-green" href="#">
Click Here To See Answers
</a>
</div>
</div>
In the end the problem was with the comment :(
I used html comment in css. That's why this happened. Thanks #CharuMaheshwari for mentioning that out. Also another thanks for other 3 answers. All of them worked.
With #CharuMaheshwari help this is the code I decided to use.
/* Awesome button css Start */
.btn-margin {
margin-top: 1.6rem;
box-sizing: inherit;
text-align: center;
}
.btn {
-webkit-tap-high!importantr: transparent;
border-radius: 2px;
box-shadow: rgba(0, 0, 0, 0.14) 0 3px 3px 0, rgba(0, 0, 0, 0.12) 0 1px 7px 0, rgba(0, 0, 0, 0.2) 0 3px 1px -1px;
box-sizing: inherit;
color: white !important;
cursor: pointer;
display: inline-block;
height: auto;
letter-spacing: 0.5px;
line-height: 42px;
pointer-events: all;
position: relative;
text-decoration-line: none;
vertical-align: middle;
font-size: 1.6em;
padding: 0 2em;
transition: 800ms ease all;
}
.btn-green {
background-color: #1AAB8A;
}
.btn-green:hover {
background-color: #fff;
color: #1AAB8A !important;
}
.btn:before,.btn:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 2px;
width: 0;
transition: 400ms ease all;
}
.btn:after {
right: inherit;
top: inherit;
left: 0;
bottom: 0;
}
.btn-green:before,.btn-green:after {
background: #1AAB8A;
}
.btn:hover:before,.btn:hover:after {
width: 100%;
transition: 800ms ease all;
}
/* Awesome button css End */
<div class="btn-margin">
<a class="btn btn-green" href="#">
Click Here To See Answers
</a>
</div>