Prevent icons inside div from collapsing to inside other div - html

So using HTML, CSS and Bootstrap, i have 4 icons on the left side of the wrapper, where they are organize similar to a square. But when i resize the window, those icons collapse behind a console that i have below. How can i prevent this from happening(would be nice to keep the buttons in the same position)?
Here's the code for the CSS and the HTML
#designContainer {
display: none;
background-color: #fff;
position: absolute;
bottom: 40px;
top: 120px;
left: 10%;
/*width of toolbar*/
margin-left: 38px;
/*margin of toolbar*/
right: 20px;
overflow: hidden;
border: 1px solid #003399;
/* border-top:3px solid #FFCC00; */
z-index: 10;
cursor: crosshair;
}
#toolsWrapper {
display: none;
background-color: #fff;
position: absolute;
bottom: 40px;
top: 120px;
left: 20px;
width: 10%;
overflow: hidden;
z-index: 11;
margin-bottom: 0;
}
#toolsWrapper label img {
position: relative;
width: 30px;
height: auto;
margin: 10px 0px;
opacity: 0.3;
transition: 0.2s;
}
#toolsWrapper [type=radio] {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
/* IMAGE STYLES */
#toolsWrapper [type=radio]+img {
cursor: pointer;
}
/* CHECKED STYLES */
#toolsWrapper [type=radio]:checked+img {
opacity: 1;
}
#toolsWrapper [type=radio]:checked+img:hover {
opacity: 1;
}
#toolsWrapper [type=radio]+img:hover {
opacity: 0.7;
}
#sideToolButtons {
margin-bottom: 20px;
}
#sideToolButtons button {
outline: none;
width: 20px;
height: auto;
margin: 0;
padding: 0;
border: 0;
background: none;
cursor: pointer;
}
#sideToolButtons button:hover>img {
opacity: 1;
}
#sideToolButtons button>img {
width: 100%;
height: 100%;
opacity: 0.7;
}
#sideToolButtons .btn_disabled img {
opacity: 0.2;
cursor: default;
}
#sideToolButtons .btn_disabled:hover>img {
opacity: 0.2;
cursor: default;
}
#calcButton {
position: absolute;
bottom: 50px;
width: 30px !important;
right: 50%;
margin-right: -10px !important;
display: none;
}
#designConsole {
width: 100%;
position: absolute;
bottom: 0;
height: 60%;
min-height: 180px;
margin-bottom: 0;
}
#innerConsole {
position: relative;
color: #333;
height: 100%;
min-height: 40px;
font-size: 9pt;
border: #002774 1px solid;
overflow: hidden;
padding: 3px 6px;
}
#innerConsole:hover {
overflow: auto;
}
#innerConsole>p {
margin: 0;
padding: 0 !important;
text-align: left;
margin-bottom: 5px !important;
}
.lastEntry {
font-weight: bold;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<fieldset class="step">
<legend id="stepTitle_2">Line Design</legend>
<div id="stepDesc_2" class="txtbox">
Make a sketch of the required line design. The composition and length of the channels are visible if you draw or adapt the line.
</div>
<div id="toolsWrapper" class="form-group">
<label id='drawtoggle' class="col-md-3">
<input type="radio" id="penToggle" name="mouseToggle" value=0 checked>
<img src="./images/draw.png">
</label>
<label id='cursortoggle' class="col-md-3">
<input type="radio" id="selToggle" name="mouseToggle" value=1>
<img src="./images/cursor.png">
</label>
<div id="sideToolButtons" class="form-group">
<button type="button" id="delButton" class="col-md-6" style="margin-left: 20px;">
<img src="./images/trash.png" alt=""/>
</button>
<button type="button" id="zoomFitButton" class="col-md-6" style="margin-left: 20px;">
<img src="./images/zoom_fit.png" alt=""/>
</button>
</div>
<div id="designConsole" class="form-group">
<!-- <div id="designDefinitions" class = "col-md-6"></div> -->
<div id="innerConsole" class="col-md-12"></div>
</div>
</div>
<div id="designContainer"></div>
</fieldset>
Thank you.

Related

how do I change the colour of the writing of the active toggle

I have a toggle button that shifts left to right depending what you select, I would like to change the colour of the text inside the button to white if that is the active toggle option you have selected so if you toggle the text inside goes white, however I'm not sure how to achieve this any help would be appreciated thank you
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button type="button" class="toggle-btn" onclick="login()">Sign in</button>
<button type="button" class="toggle-btn" onclick="register()">Register</button>
</div>
.form-box {
width: 380px;
height: 660px;
position: relative;
margin: 20% auto;
padding: 5px;
overflow: hidden;
bottom: 150px;
}
.button-box {
width: 220px;
left: 100px;
top: 50px;
position: relative;
display: flex;
box-shadow: 0 0 10px 3px #ff61241f;
border-radius: 30px;
}
.toggle-btn {
padding: 10px 30px;
cursor: pointer;
background: transparent;
border: 0;
outline: none;
position: relative;
}
#btn {
display: flex;
margin-right: auto;
margin-left: auto;
position: absolute;
width: 110px;
height: 100%;
background-color: #fd886b;
border-radius: 30px;
transition: .5s;
}
I have removed the login() and register() functions as they don't serve any purpose to this problem. Also only the text color changes and not the background color as it was not asked but the idea is similar.
function fun(x) {
if(x===1)
{
document.getElementById("b1").style.color="white";
document.getElementById("b2").style.color="black";
}
else
{
document.getElementById("b2").style.color="white";
document.getElementById("b1").style.color="black";
}
}
.form-box {
width: 380px;
height: 660px;
position: relative;
margin: 20% auto;
padding: 5px;
overflow: hidden;
bottom: 150px;
}
.button-box {
width: 220px;
left: 100px;
top: 50px;
position: relative;
display: flex;
box-shadow: 0 0 10px 3px #ff61241f;
border-radius: 30px;
}
.toggle-btn {
padding: 10px 30px;
cursor: pointer;
background: transparent;
border: 0;
outline: none;
position: relative;
}
#btn {
display: flex;
margin-right: auto;
margin-left: auto;
position: absolute;
width: 110px;
height: 100%;
background-color: #fd886b;
border-radius: 30px;
transition: .5s;
}
<div class="form-box">
<div class="button-box">
<div id="btn"></div>
<button id="b1" type="button" class="toggle-btn" onclick="fun(1)" style="color: white">Sign in</button>
<button id="b2" type="button" class="toggle-btn" onclick="fun(2)">Register</button>
</div>
</div>

How do I incorporate arrows in my css/html image slider?

I am trying to add arrows on the left and right side of the slider but even though the arrows Z-index is lower than the navigations Z-index, the surface above the arrows is not clickable.
Everything else works, but you can't have an image slider where the arrows are not clickable even though the surroundings of it is.
Please I have tried everything, my mind could come up with. Do you have any idea what could cause this problem? And how to fix it?
body {
margin: 0;
}
#container {
width: 960px;
height: 740px;
position: relative;
margin: 0px;
}
#container input {
display: none;
}
.images {
width: 100%;
height: 100%;
position: absolute;
}
.images img {
width: 100%;
height: 100%;
margin: 0px;
}
.prev,
.next {
height: 100%;
width: 12%;
position: absolute;
top: 0;
transition: .15s;
z-index: 100;
margin: 0px;
}
.prev:hover,
.next:hover {
cursor: pointer;
/* background: rgba(10, 10, 10, .5);*/
}
.prev {
left: 0
}
.next {
right: 0
}
#nav {
width: 100%;
height: 35px;
position: absolute;
bottom: 0px;
text-align: center;
cursor: arrow;
z-index: 100;
}
.dots {
width: 12px;
height: 12px;
margin: 0 4px;
border-radius: 50%;
background: rgba(10, 10, 10, .7);
position: relative;
display: inline-block;
cursor: pointer;
}
.dots:hover {
*background: rgba(245, 245, 245, .7);
}
#one,
#two,
#three {
z-index: -1;
}
#inp1:checked~#one,
#inp2:checked~#two,
#inp9:checked~#three {
z-index: 10;
}
#inp1:checked~#nav #dot1,
#inp2:checked~#nav #dot2,
#inp9:checked~#nav #dot3 {
background: white;
opacity: 70%;
}
.arrow:hover {
cursor: pointer;
}
.arrow {
border: solid white;
border-width: 0 6px 6px 0;
display: inline-block;
padding: 10px;
color: white;
opacity: 70%;
margin: 0px;
z-index: 11;
left: 0;
right: 0;
}
.right {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
position: relative;
left: 900px;
top: 400px;
}
.left {
transform: rotate(135deg);
position: relative;
top: 400px;
right: 0px;
}
<div id='container'>
<input type='radio' name="image" id='inp1' checked>
<input type='radio' name="image" id='inp2'>
<input type='radio' name="image" id='inp3'>
<i class="arrow right"></i>
<i class="arrow left"></i>
<div class='images' id='one'>
<img src='img/image1.jpeg'>
<label for='inp3' class='prev'></label>
<label for='inp2' class='next'></label>
</div>
<div class='images' id='two'>
<img src='img/image2.jpeg'>
<label for='inp1' class='prev'></label>
<label for='inp3' class='next'></label>
</div>
<div class='images' id='three'>
<img src='img/image3.jpeg'>
<label for='inp2' class='prev'></label>
<label for='inp1' class='next'></label>
</div>
<div id='nav'>
<label class='dots' id='dot1' for='inp1'></label>
<label class='dots' id='dot2' for='inp2'></label>
<label class='dots' id='dot3' for='inp3'></label>
</div>
</div>

Web page layout appearing differently on different screens

I have designed my web page,
HTML code,
<div class="firstDiv"></div>
<div class="secondDiv"></div>
<div class="loginDiv">
<form>
<div class="row center">
<i class="fa fa-user-circle"></i>
</div>
<div class="container">
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required>
<br/>
<br/>
<button mat-button (click)="submit()">Login</button>
<br/>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
</form>
</div>
CSS code,
#import '~#angular/material/theming';
#include mat-core();
$yaana-app-primary: mat-palette($mat-orange, 800,400,200);
.firstDiv {
height: 40%;
width: 100%;
top: 0;
left: 0;
right: 0;
position: absolute;
background-color: orangered;
display: inline-block;
}
.secondDiv {
position: absolute;
width: 100%;
bottom: 0;
height: 60%;
left: 0;
right: 0;
background-color:whitesmoke;
display: inline-block;
}
.loginDiv {
border: 1px solid black;
background: white;
left: 50%;
position: absolute;
top: 28%;
transform: translate(-50%);
background-color: #fff;
padding: 15px;
box-shadow:1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
width: 60%;
height: 20%;
line-height: 36px;
background: transparent;
border-radius: 3px;
will-change: transform;
-webkit-transition: all .2s ease;
transition: all .2s ease;
border: none;
/*border: 2px solid #FF5126;*/
cursor: pointer;
background: #F26722;
font-size: 16px;
color: #fff;
outline: none;
text-align: center;
padding: 0 6px;
margin: 6px 8px;
display: block;
margin: auto;
font-size: 14px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
text-transform: uppercase !important;
}
button:hover {
opacity: 0.8;
}
.loginImgContainer {
display: table;
max-height: 40px;
max-width: 40px;
}
i.fa {
background: #fff;
display: inline-block;
font-size: 80px;
transform: translateY(-60%);
transform: translateX(160%);
border-radius: 50%;
margin: auto;
position: relative;
}
And when I run the web page I am getting different views,
1) For Desktop Browser
2) For small screens such as IPhone 6
3) For Ipad Pro,
I wanted the user icon to appear at centre but it is getting deviated from centre based on screen sizes.
Using a flexbox for the row that contains the circle. Documentation in the source.
/* Added display flex for circle row */
div.row.center {
display: flex;
justify-content: center;
width: 100%;
}
.firstDiv {
height: 40%;
width: 100%;
top: 0;
left: 0;
right: 0;
position: absolute;
background-color: orangered;
display: inline-block;
}
.secondDiv {
position: absolute;
width: 100%;
bottom: 0;
height: 60%;
left: 0;
right: 0;
background-color: whitesmoke;
display: inline-block;
}
.loginDiv {
border: 1px solid black;
background: white;
left: 50%;
position: absolute;
top: 28%;
transform: translate(-50%);
background-color: #fff;
padding: 15px;
box-shadow: 1px 3px 10px rgba(0, 0, 0, 0.34);
}
input[type=text],
input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
width: 60%;
height: 20%;
line-height: 36px;
background: transparent;
border-radius: 3px;
will-change: transform;
-webkit-transition: all .2s ease;
transition: all .2s ease;
border: none;
/*border: 2px solid #FF5126;*/
cursor: pointer;
background: #F26722;
font-size: 16px;
color: #fff;
outline: none;
text-align: center;
padding: 0 6px;
margin: 6px 8px;
display: block;
margin: auto;
font-size: 14px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
text-transform: uppercase !important;
}
button:hover {
opacity: 0.8;
}
.loginImgContainer {
display: table;
max-height: 40px;
max-width: 40px;
}
i.fa {
background: #fff;
display: inline-block;
font-size: 80px;
/* transform: translateY(-60%); removed */
/* transform: translateX(160%); removed */
border-radius: 50%;
/* margin: auto; removed */
/* position: relative; removed */
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="firstDiv"></div>
<div class="secondDiv"></div>
<div class="loginDiv">
<form>
<div class="row center">
<i class="fa fa-user-circle"></i>
</div>
<div class="container">
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="psw" required>
<br/>
<br/>
<button mat-button (click)="submit()">Login</button>
<br/>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
</form>
</div>
try this for your circle div
position: absolute;
left: 0;
right: 0;
margin: auto;
Super easy to fix.
You have transforms on your circle for some reason see code:
i.fa {
background: #fff;
display: inline-block;
font-size: 80px;
/* transform: translateY(-60%); */
/* transform: translateX(160%); */
border-radius: 50%;
margin: auto;
position: relative;
}
Remove these 2 lines commented out and then add the following css:
.center {
text-align: center;
}

CSS: A similar effect to placing an element's box shadow at a different z-index than the element

I have a container which holds an image and a panel the appears when you hover over that image. I am trying to get the box shadow on the panel to appear behind the image, while the rest of the panel overlaps the image.
What I have vs. What I'd like to have
HTML:
<div class="container">
<img class="icon" src="http://placehold.it/350x350" />
<div class="sum-container left">
<img src="http://placehold.it/350x150" />
</div>
</div>
CSS:
.container .sum-container {
position: absolute;
top: 0;
bottom: 0;
border: solid 5px blue;
background-color: white;
width: 250px;
height: 200px;
max-height: 100%;
opacity: 0;
overflow: hidden;
z-index: 5;
pointer-events: none;
transition-property: opacity;
transition-duration: .250s;
}
.container .sum-container.left {
right: 100%;
margin-right: -5px;
border-right: none;
padding-right: 0px;
box-shadow: 5px 5px 0px #888888;
}
.container .icon:hover + .sum-container {
z-index: 6;
opacity: 1;
}
.container {
position: absolute;
left: 300px;
top: 20px;
}
.container img {
width: 100%;
}
.icon {
margin-left: auto;
margin-right: auto;
display: block;
width: 100%;
height: auto;
max-width: 480px;
background-color: blue;
box-shadow: 5px 5px 0px #888888;
text-align: center;
font-size: 26px;
color: white;
text-decoration: none;
padding: 5px;
cursor: pointer;
border: none;
outline: none;
user-drag: none;
}
I've included a JSFiddle as well.
Also, still new here. If anyone can suggest a better title, please let me know. I realize you can't actually set multiple z-indexes for one element, but I'm looking for a solution with a similar effect.
If I understand the end goal, you can make the shadow a pseudo element with a negative z-index and remove the z-index from .sum-container and .sum-container will be over .icon and it's pseudo element will be under both of them.
.container .sum-container {
position: absolute;
top: 0;
bottom: 0;
border: solid 5px blue;
background-color: white;
width: 250px;
height: 200px;
max-height: 100%;
opacity: 1;
pointer-events: none;
transition-property: opacity;
transition-duration: .250s;
}
.sum-container:after {
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
content: '';
background: #888;
transform: translate(0,10px);
z-index: -1;
}
.container .sum-container.left {
right: 100%;
margin-right: -5px;
border-right: none;
padding-right: 0px;
}
.container .icon:hover + .sum-container {
opacity: 1;
}
.container {
position: absolute;
left: 300px;
top: 20px;
}
.container img {
width: 100%;
}
.icon {
margin-left: auto;
margin-right: auto;
display: block;
width: 100%;
height: auto;
max-width: 480px;
background-color: blue;
box-shadow: 5px 5px 0px #888888;
text-align: center;
font-size: 26px;
color: white;
text-decoration: none;
padding: 5px;
cursor: pointer;
border: none;
outline: none;
user-drag: none;
}
<div class="container">
<img class="icon" src="http://placehold.it/350x350" />
<div class="sum-container left">
<img src="http://placehold.it/350x150" />
</div>
</div>

Background Color Fill Animation Ends in Offset

I'm trying to "fill" a circle when a user clicks on it. The main issue is that when the animation ends, it's offset on the top by just a little bit. I've tried to add a margin-top: -1px to it but it's then offset on the bottom!
I'm open to any suggestion to make the animation smoother but my main question is: Why is the end result offset from the top a tiny bit and how can I fix it?
#searchOptions label {
display: inline-block;
cursor: pointer;
font-size: 14px;
text-transform: uppercase;
color: #000;
font-weight: 400;
margin-right: 40px;
}
#searchOptions label .circle {
display: inline-block;
position: relative;
border: 2px solid #000;
width: 15px;
height: 15px;
border-radius: 50%;
margin-right: 12px;
}
#searchOptions label .circle:before {
display: none;
position: absolute;
content: '';
background-color: #000;
border-radius: 50%;
top: 50%;
transform: translateY(-50%);
left: 0;
right: 0;
margin: 0 auto;
width: 2px;
height: 2px;
}
#searchOptions label .txt {
position: relative;
top: -3px;
}
#searchOptions input[type=radio] {
height: 0;
width: 0;
opacity: 0;
}
#searchOptions input[type=radio]:checked + label .circle:before {
display: block;
width: 100%;
height: 100%;
animation: fillRadio ease-in 1s;
}
#-webkit-keyframes fillRadio {
0% {
top: 50%;
transform: translateY(-50%);
width: 1%;
height: 1%;
}
100% {
top: 0%;
transform: translateY(0%);
width: 100%;
height: 100%;
}
}
<div id="searchOptions">
<input type="radio" name="searchType" value="option1" id="option1" />
<label for="option1"><span class="circle"></span> <span class="txt">Option 1</span>
</label>
<input type="radio" name="searchType" value="option2" id="option2" />
<label for="option2"><span class="circle"></span> <span class="txt">Option 2</span>
</label>
</div>
<!-- id="searchOptions" -->
Here's a JSFiddle if anyone would rather use that.
I believe that the problem comes from a dimensiion of 15px and top of 50% -> that gives a fractional size
I have changed the size to 16px, that is even:
#searchOptions label {
display: inline-block;
cursor: pointer;
font-size: 14px;
text-transform: uppercase;
color: #000;
font-weight: 400;
margin-right: 40px;
}
#searchOptions label .circle {
display: inline-block;
position: relative;
border: 2px solid #000;
width: 16px;
height: 16px;
border-radius: 50%;
margin-right: 12px;
}
#searchOptions label .circle:before {
display: none;
position: absolute;
content: '';
background-color: #000;
border-radius: 50%;
top: 50%;
transform: translateY(-50%);
left: 0;
right: 0;
margin: 0 auto;
width: 2px;
height: 2px;
}
#searchOptions label .txt {
position: relative;
top: -3px;
}
#searchOptions input[type=radio] {
height: 0;
width: 0;
opacity: 0;
}
#searchOptions input[type=radio]:checked + label .circle:before {
display: block;
width: 100%;
height: 100%;
animation: fillRadio ease-in 1s;
}
#-webkit-keyframes fillRadio {
0% {
top: 50%;
transform: translateY(-50%);
width: 1%;
height: 1%;
}
100% {
top: 0%;
transform: translateY(0%);
width: 100%;
height: 100%;
}
}
<div id="searchOptions">
<input type="radio" name="searchType" value="option1" id="option1" />
<label for="option1"><span class="circle"></span> <span class="txt">Option 1</span>
</label>
<input type="radio" name="searchType" value="option2" id="option2" />
<label for="option2"><span class="circle"></span> <span class="txt">Option 2</span>
</label>
</div>
<!-- id="searchOptions" -->