I'm sure the answer is right in front of me, but I have searched and searched for hours and have been unable to come up with a fix. I am wondering how to have my background image fill the whole screen. It fills most of the screen, except where the header would be. I can get the full screen background image, only when I comment out the "Form" component. When I go to inspect the portion that is not filled, it says it shows as html, which I suspect is pulled from the index.html file in the public folder. I would greatly appreciate any and all help on this.
App.js
import React from 'react';
import './App.css';
import Form from './Form';
import wallstreet from './images/wallstreet.png';
function App() {
return (
<div className="App">
<div className="overlay"
style={{backgroundImage: `url(${wallstreet})`}} />
<Form />
</div>
);
}
export default App;
App.css
#import url('https://fonts.googleapis.com/css2?family=PT+Sans&display=swap');
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'PT Sans', sans-serif;
}
.overlay {
position: fixed;
min-width: 100%;
min-height: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
Form.js
import React, { useState } from 'react';
import FormSignup from './FormSignup';
import FormSuccess from './FormSuccess';
import './Form.css';
const Form = () => {
const [isSubmitted, setIsSubmitted] = useState(false)
function submitForm() {
setIsSubmitted(true);
}
return (
<>
<div className="form-container">
<span className="close-btn">x</span>
<div className="form-content-left">
<img className='form-img' src='images/bullish.png' alt='bullish' />
</div>
{!isSubmitted ? (<FormSignup submitForm=
{submitForm} />) : <FormSuccess />}
</div>
</>
);
};
export default Form;
Form.css
.form-container {
margin: 100px auto;
width: 1000px;
box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2), 0 7px 20px 0 rgba(0, 0, 0, 0.2);
position: relative;
border-radius: 10px;
height: 600px;
display: grid;
grid-template-columns: 1fr 1fr;
}
.close-btn {
position: absolute;
top: 2%;
right: 3%;
font-size: 1.5rem;
z-index: 1;
color: #fff;
cursor: pointer;
}
.form-content-left {
background: linear-gradient(
90deg,
rgb(39, 176, 255) 0%,
rgb(0, 232, 236) 100%
);
border-radius: 10px 0 0 10px;
position: relative;
}
.form-img {
width: 80%;
height: 80%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.form-img-2 {
width: 60%;
height: 60%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.form-success {
text-align: center;
font-size: 24px;
margin-top: 80px;
color: #fff;
}
.form-content-right {
border-radius: 0 10px 10px 0;
position: relative;
background: linear-gradient(90deg, rgb(40, 40, 40) 0%, rgb(17, 17, 17) 100%);
}
.form {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.form h1 {
font-size: 1rem;
text-align: start;
width: 80%;
margin-bottom: 1rem;
color: #fff;
}
.form-inputs {
margin-bottom: 0.5rem;
width: 80%;
}
.form-inputs p {
font-size: 0.8rem;
margin-top: 0.5rem;
color: #f00e0e;
}
.form-label {
display: inline-block;
font-size: 0.8rem;
margin-bottom: 6px;
color: #fff;
}
.form-input {
display: block;
padding-left: 10px;
outline: none;
border-radius: 2px;
height: 40px;
width: 100%;
border: none;
}
.form-input::placeholder {
color: #595959;
font-size: 12px;
}
.form-input-btn {
width: 80%;
height: 50px;
margin-top: 10px;
border-radius: 2px;
background: linear-gradient(
90deg,
rgb(39, 176, 255) 0%,
rgb(0, 232, 236) 100%
);
outline: none;
border: none;
color: #fff;
font-size: 1rem;
}
.form-input-btn:hover {
cursor: pointer;
background: linear-gradient(
90deg,
rgb(39, 143, 255) 0%,
rgb(12, 99, 250) 100%
);
transition: all 0.4s ease-out;
}
.form-input-login {
font-size: 0.8rem;
margin-top: 10px;
color: #fff;
width: 80%;
text-align: center;
}
.form-input-login a {
text-decoration: none;
color: #27cdff;
font-weight: 6
00;
}
Did you try 100vh and 100vw along with position absolute.
also search if any of the parent element is having relative position
Related
I'm trying to create a title that has a glass looking visual which blurs the background image.
I was able to do it but I had to make references to the background image 3 times and it doesn't seem very optimal.
Here is the code I used.
body {
background: blue url("https://images5.alphacoders.com/318/318370.jpg") no-repeat center center fixed;
background-size: cover;
}
.bimage {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url("https://images5.alphacoders.com/318/318370.jpg") no-repeat center center fixed;
filter: blur(10px);
background-size: cover;
}
.title {
position: relative;
width: 100%;
height: 500px;
overflow: hidden;
}
h2 {
font-family: Verdana;
position: absolute;
top: 0;
left: 0;
//display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 500px;
margin: 0;
font-weight: bold;
font-size: 18vw;
text-align: center;
text-transform: uppercase;
mix-blend-mode: screen;
}
.mask {
background: #fff;
}
#h2 {
background: url("https://images5.alphacoders.com/318/318370.jpg") no-repeat center center fixed;
color: rgba(255, 255, 255, 1);
background-size: cover;
mix-blend-mode: multiply;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: rgba(255, 255, 255, 0.4);
text-shadow: 3px 3px 10px black;
}
<div class="title">
<div id="bimage" class="bimage"></div>
<h2 class="mask">MARIO</h2>
<h2 id="h2">MARIO</h2>
</div>
https://codepen.io/marceltoma/pen/zYWGYwp
I wonder if there's a better way to do this.
Looking at your codepen, you can start reusing css in many places.
This is just an example for you to get started:
/* Reusing background properties */
#h2, body, .bimage {
background: url("https://images5.alphacoders.com/318/318370.jpg") no-repeat center center fixed;
background-size: cover;
}
/* Reusing with children selector */
.title, .title * {
width: 100%;
position: absolute;
top: 0;
left: 0;
}
body {
background-color: blue
}
.bimage {
height: 100%;
filter: blur(10px);
}
.title {
position: relative;
height: 500px;
overflow: hidden;
}
h2 {
font-family:Verdana;
//display: flex;
align-items: center;
justify-content: center;
height: 500px;
margin: 0;
font-weight: bold;
font-size: 18vw;
text-align: center;
text-transform: uppercase;
mix-blend-mode: screen;
}
.mask {
background: #fff;
}
#h2 {
color: rgba(255,255,255,1);
mix-blend-mode: multiply;
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: rgba(255, 255, 255, 0.4);
text-shadow: 3px 3px 10px black;
}
<div class="title">
<div id="bimage" class="bimage"></div>
<h2 class="mask">MARIO</h2>
<h2 id="h2">MARIO</h2>
</div>
Please give it a try, and keep DRY!
I am using Angular 9 and ngx-toastr
I have the task of using toastr to create a set of toasts which look quite different from the default toast styles. Each in the set are basically the same, except for border colour, fontawesome icon and message (which I can just pass in).
Here is one of the toast mockups: enter image description here
Toastr has it's own toastr.css style sheet which I added to angular.json. Without it, toasts won't even open. I have my own toast-messages.scss file that contains all the css to realize my mockup. I will include it. It's also added to angular.json
"styles": [
"node_modules/#fortawesome/fontawesome-free/css/fontawesome.css",
"node_modules/#fortawesome/fontawesome-free/css/solid.css",
"src/styles.scss",
"node_modules/ngx-toastr/toastr.css",
"src/app/styles/toast-messages.scss"
],
What I find is that unless every line in my toast-messages.scss file needs an !important in it for it to override what's in the toastr.css and you know that's horrible.
my question
What are my options to create this style of toast without using all these !important tags in my css. Am I referencing the css/scss files in the wrong spot? Should I create a custom toast and if so, is there a good resource for that? I am only 2 months into Angular.
toast-messages.scss I know my formatting is horrible, this has been trial and error
.toast-container .ngx-toastr {
position: relative;
width: 888px;
height: 79px;
margin-left: auto;
margin-right: auto;
top: 60px;
padding-right: 0px;
padding-top: 0px;
padding-bottom: 0px;
border-radius: 5px;
background-position: 15px center;
background-repeat: no-repeat;
background-size: 24px;
box-shadow: 0 0 12px #999999;
color: #FFFFFF;
}
.toast-container .ngx-toastr:hover {
box-shadow: 0 0 12px #000000 ;
opacity: 1;
cursor: pointer ;
}
.toast-container {
pointer-events: none;
position: fixed;
z-index: 9999;
}
.toast-container * {
box-sizing: border-box;
}
.toast-message {
position: relative;
word-wrap: break-word;
background-color: #FFFFFF;
top: 2px;
width: 886px;
height: 75px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
.message-boxy {
top: 2px;
width: 886px;
height: 75px;
}
.message-symbol {
background-color: #800017;
width: 79px;
height: 75px;
text-align: center;
position: relative;
float: left;
left: 0px;
}
.message-symbol i {
width: 28px;
height: 28px;
transform: translateY(0.7em);
}
.toast-text-container {
position: relative;
width:886px;
border-style:solid;
border-color: #FFAE15;
border-width:2px;
left: 0px;
height: 75px;
background-color: transparent;
z-index: 10;
}
.message-text {
line-height: 75px;
border-style:solid;
left: 79px;
height: 75px;
border-color: #157EF9;
border-width:2px;
width: 500px;
letter-spacing: 0px;
text-align: left;
text-indent: 10px;
font-weight: bold;
font-size: 18px;
color: #555555;
z-index: 10;
}
.btncontainer {
background-color: pink;
position: relative;
float:right;
padding: 0 20px;
z-index: 20;
}
.reloadpage {
color: #157EF9;
font-weight: bold;
opacity: 1;
z-index: 20;
}
.reloadpage:hover {
opacity: 0.8;
}
.toast-close-button {
border: none;
top: 27px;
right: 10px;
float: right;
background-color: #FFFFFF;
width: 25px !important;
height: 25px !important;
opacity: 1;
z-index: 10;
}
/*Additional properties for button version
iOS requires the button element instead of an anchor tag.
If you want the anchor version, it requires `href="#"`.*/
button.toast-close-button {
cursor: pointer;
border: none;
background-color: #FFFFFF;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='rgb(255,255,255)' d='M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z'/%3E%3C/svg%3E");
width: 25px !important;
height: 25px !important;
opacity: 1;
z-index: 10;
}
.toast-close-button:hover,
.toast-close-button:focus {
text-decoration: none;
cursor: pointer;
opacity: 1;
}
/* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/info-circle.svg */
.toast-info {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='rgb(255,255,255)' d='M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z'/%3E%3C/svg%3E");
width: 28.74px;
height: 28.74px;
padding: 25px;
}
/* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/times-circle.svg */
.toast-error {
background-image: none;
}
/* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/check.svg */
.toast-success {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='rgb(255,255,255)' d='M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z'/%3E%3C/svg%3E");
width: 28.74px;
height: 70px;
justify-self: center !important;
}
/* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/exclamation-triangle.svg */
.toast-warning {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512'%3E%3Cpath fill='rgb(255,255,255)' d='M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z'/%3E%3C/svg%3E");
width: 28.74px;
height: 28.74px;
}
.toast-container.toast-top-full-width .ngx-toastr,
.toast-container.toast-bottom-full-width .ngx-toastr {
width: 96%;
margin-left: auto;
margin-right: auto;
}
.ngx-toastr {
background-color: #030303;
pointer-events: auto;
}
.toast-success {
background-color: #4C6A13;
}
.toast-error {
background-color: #800017;
}
.toast-info {
background-color: #555555;
}
.toast-warning {
background-color: #FFAE15;
}
.toast-progress {
position: absolute;
left: 0;
bottom: 0;
height: 4px;
background-color: #000000;
opacity: 0.4;
}
You can create your custom toast as mentioned in the documentation
You can follow this code:
import {
animate,
keyframes,
state,
style,
transition,
trigger
} from '#angular/animations';
import { Component } from '#angular/core';
import { Toast, ToastrService, ToastPackage } from '../lib/public_api';
#Component({
selector: '[pink-toast-component]',
styles: [`
:host {
background-color: #FF69B4;
position: relative;
overflow: hidden;
margin: 0 0 6px;
padding: 10px 10px 10px 10px;
width: 300px;
border-radius: 3px 3px 3px 3px;
color: #FFFFFF;
pointer-events: all;
cursor: pointer;
}
.btn-pink {
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0);
}
`],
template: `
<div class="row" [style.display]="state.value === 'inactive' ? 'none' : ''">
<div class="col-9">
<div *ngIf="title" [class]="options.titleClass" [attr.aria-label]="title">
{{ title }}
</div>
<div *ngIf="message && options.enableHtml" role="alert" aria-live="polite"
[class]="options.messageClass" [innerHTML]="message">
</div>
<div *ngIf="message && !options.enableHtml" role="alert" aria-live="polite"
[class]="options.messageClass" [attr.aria-label]="message">
{{ message }}
</div>
</div>
<div class="col-3 text-right">
<a *ngIf="!options.closeButton" class="btn btn-pink btn-sm" (click)="action($event)">
{{ undoString }}
</a>
<a *ngIf="options.closeButton" (click)="remove()" class="btn btn-pink btn-sm">
close
</a>
</div>
</div>
<div *ngIf="options.progressBar">
<div class="toast-progress" [style.width]="width + '%'"></div>
</div>
`,
animations: [
trigger('flyInOut', [
state('inactive', style({
opacity: 0,
})),
transition('inactive => active', animate('400ms ease-out', keyframes([
style({
transform: 'translate3d(100%, 0, 0) skewX(-30deg)',
opacity: 0,
}),
style({
transform: 'skewX(20deg)',
opacity: 1,
}),
style({
transform: 'skewX(-5deg)',
opacity: 1,
}),
style({
transform: 'none',
opacity: 1,
}),
]))),
transition('active => removed', animate('400ms ease-out', keyframes([
style({
opacity: 1,
}),
style({
transform: 'translate3d(100%, 0, 0) skewX(30deg)',
opacity: 0,
}),
]))),
]),
],
preserveWhitespaces: false,
})
export class PinkToast extends Toast {
// used for demo purposes
undoString = 'undo';
// constructor is only necessary when not using AoT
constructor(
protected toastrService: ToastrService,
public toastPackage: ToastPackage,
) {
super(toastrService, toastPackage);
}
action(event: Event) {
event.stopPropagation();
this.undoString = 'undid';
this.toastPackage.triggerAction();
return false;
}
}
Hello I have a parent with positon absolut and height: self that is not with the height of children like this:
css:
const UserProfile = styled.div`
display: flex;
justify-content: center;
align-items: center;
padding: 0 0.5rem;
cursor: pointer;
position: relative;
& .user_text {
cursor: pointer;
display: flex !important;
flex-direction: column;
padding-right: 0.75rem !important;
span:first-of-type {
font-size: 1rem;
color: #b5b5c3 !important;
font-weight: 500 !important;
text-align: right !important;
}
span:last-of-type {
font-size: 1rem;
color: #464e5f !important;
font-weight: 600 !important;
text-align: right !important;
}
}
& .user_avatar {
border-radius: 50%;
flex-shrink: 0;
position: relative;
transition: border-color 0.2s;
width: 45px;
z-index: 1;
img {
min-height: 100%;
object-fit: cover;
-o-object-fit: cover;
width: 100%;
}
}
`;
const UserCanvas = styled.div`
position: absolute;
min-width: 10rem;
display: ${props => (props.isOpen ? "block" : "none")};
border: 1px solid rgba(0, 0, 0, 0.15);
border-color: rgba(120, 130, 140, 0.13);
box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
top: 100%;
bottom: 0;
font-size: 1rem;
color: #212529;
background-color: #fff;
background-clip: padding-box;
border-radius: 0.25rem;
& .test {
min-width: 10rem;
height: 200px;
}
`;
jsx:
<UserProfile onClick={() => setOpen(!isOpen)}>
<div className="user_text">
<span>SpiriT</span>
<span>Web Developer</span>
</div>
<div className="user_avatar">
<img src={LogoImage} />
</div>
<UserCanvas isOpen={isOpen}>
<div className="test">a</div>
</UserCanvas>
</UserProfile>
example:
https://codesandbox.io/s/youthful-hooks-ceo85?file=/src/App.js:743-2099
basically i need the div with position absolute and height auto to follow the height of yours children
Change the display to table for the parent component and table-row t like this:
const UserCanvas = styled.div`
// ... other properties
display: ${props => (props.isOpen ? "table" : "none")};
& .test {
min-width: 10rem;
height: auto;
display: table-row;
}
`;
Alternately, you can add height: max-content; to the Parent Component.
I have a React Login screen with black background set using CSS Styling. The login screen is quite elementary at this point which comprises of 3 input tag username, password and submit respectively.
All i am trying to do right now is change the background of the login screen with slide down effect (height 0 to height $loginScreenHeight) whenever the mouse moves.
I got it working as expected but with a slight side-effect. The side-effect is whenever the mouse moves the initial background goes away momentarily and the new background starts sliding down.
I want the new background to start sliding on top of the old background and cover it up. Can some Css expert please throw a light on what i am missing here?
Following is my code.
import React from "react";
import axios from "axios";
import { connect } from "react-redux";
import { userlogin } from "./../action/userLogin";
class Login extends React.Component {
state = {
email: "",
passwd: "",
loginStatus: "",
mouseOverLogin: false
};
enteruname = e => this.setState({ email: e.target.value });
enterpasswd = e => this.setState({ passwd: e.target.value });
submitCredentials = e => e.preventDefault();
render() {
return (
<div
className="login"
onMouseMove={() => this.setState({ mouseOverLogin: true })}
>
<form
onSubmit={this.submitCredentials}
className={
this.state.mouseOverLogin ? "loginForm animateLogin" : "loginForm"
}
>
<p>Login</p>
<hr />
<input
className="uname"
placeholder="Enter Username"
type="email"
name="email"
value={this.state.email}
onChange={this.enteruname}
/>
<input
className="passwd"
placeholder="Enter Password"
type="password"
name="passwd"
value={this.state.passwd}
onChange={this.enterpasswd}
/>
<button className="loginBtn">Login</button>
</form>
</div>
);
}
}
export default connect()(Login);
CSS File:-
.login {
width: 100vw;
height: 100vh;
overflow: hidden;
position: absolute;
top: 0vh;
left: 0vw;
}
.loginForm {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
top: 25vh;
left: 38vw;
width: 27vw;
height: 54vh;
background: rgba(0, 0, 0, 0.7);
position: relative;
z-index: 1000;
border-radius: 20px;
}
.login form input {
margin: 0 auto;
width: 24vw;
height: 6vh;
border-radius: 20px;
outline: none;
background: rgba(42, 27, 61, 0.6);
color: white;
text-align: center;
font-size: 1.2rem;
}
.uname {
position: absolute;
top: 18vh;
}
.uname:focus,
.passwd:focus {
background: rgba(42, 27, 61, 0.6);
}
.passwd {
position: absolute;
top: 28vh;
}
.loginBtn {
position: absolute;
width: 50%;
height: 5vh;
left: 25%;
text-decoration: none;
outline: none;
top: 38vh;
border-radius: 20px;
background: rgba(42, 27, 61, 0.6);
color: white;
}
.login form input::placeholder {
color: white;
text-align: center;
font-size: 1.2rem;
}
.login form p {
color: white;
font-size: 25px;
width: 24vw;
position: absolute;
top: 5vh;
left: 2vw;
}
.animateLogin {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 25vh;
left: 38vw;
width: 27vw;
animation: slideDown 2s 1 forwards ease-in-out;
z-index: 0;
// transition: all 280ms ease-in-out;
}
#keyframes slideDown {
from {
height: 0;
background: rgba(0, 0, 0, 0.7);
}
to {
background: $navlink;
height: 54vh;
}
}
hr {
position: absolute;
top: 12vh;
width: 24vw;
height: 1px;
background: white;
}
the height change to 0 is a problem because the "old background" is set on the element with 0 height.
I wrote 2 POC that can help you:
.a,
.b {
margin: 10px;
padding: 10px;
height: 30px;
text-align: center;
border: solid 1px blue;
background: green;
position: relative;
}
.a:hover {
animation: slidebg 2s;
box-shadow: inset 0 50px 0 0 blue;
}
#keyframes slidebg {
0% {
box-shadow: inset 0 0 0 0 blue;
}
100% {
box-shadow: inset 0 50px 0 0 blue;
}
}
.b-bg {
position: absolute;
height: 0;
top: 0;
left: 0;
background: blue;
width: 100%;
}
.b span {
position: relative;
z-index: 10;
}
.b:hover .b-bg {
animation: slidebg2 2s;
height: 100%;
}
#keyframes slidebg2 {
0% {
height: 0;
}
100% {
height: 100%;
}
}
<div class="a">link</div>
<div class="b">
<div class="b-bg"></div>
<span>link</span>
</div>
I must be misunderstaning something in CSS as my dropdown box using a library (dat-gui) is doing this:
I have tried switching to position: absolute for the divs beneath the dat-gui container, which breaks the divs beneath it.
Funnily enough, when I use the SO embedded snippet, it actually works. So check out an actual deploy of the site at: https://stack-test.netlify.com/
function UI (parentDiv) {
// parentDiv.querySelector('#dataset_div').style.display = 'none'
// parentDiv.querySelector('#channel_div').style.display = 'none'
// parentDiv.querySelector('#OpenCORLinkButton').style.display = 'none'
// parentDiv.querySelector('#instructions_div').style.display = 'none'
var _this = this
_this.dataType = 'scatter'
const gui = new dat.GUI({autoPlace: false})
gui.domElement.id = 'gui'
gui.close()
document.getElementsByClassName('dat-gui-container')[0].appendChild(gui.domElement)
var folder = gui.addFolder('Channels')
var settings = {}
var checkboxes = []
var checkboxElements = []
this.createDatGuiDropdown = function (channels, onchangeFunc) {
_this.channels = [...channels]
if (channels[0].toLowerCase().includes('time')){
channels.shift()
}
checkboxes = []
for (let i in _this.channels) {
let name = _this.channels[i]
let checkbox = {}
checkbox[name] = false
checkboxes.push(checkbox)
var el = folder.add(checkboxes[i], name)
checkboxElements.push(el)
el.__checkbox.onclick = onchangeFunc
}
folder.open()
}
}
var ui = new UI('unused')
ui.createDatGuiDropdown(['one', 'two'], function(){console.log('clicked')})
/*//////////////////////////////////////////////////////////////////
[ dat-gui ]*/
.dat-gui-container{
position: absolute;
top: 0;
left: 0;
right: 0;
height: 95%;
z-index: 5;
}
/*//////////////////////////////////////////////////////////////////
[ login ]*/
.limiter {
width: 100%;
margin: 0 auto;
}
.container-login100 {
width: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
padding: 10px;
position: relative;
background-position: center;
background-size: cover;
background-repeat: no-repeat;;
}
.wrap-login100 {
width: 390px;;
background: #fff;
border-radius: 10px;
position: relative;
}
.wrap-data100 {
width: 90%;
background: #fff;
border-radius: 10px;
position: relative;
}
/*==================================================================
[ Form ]*/
.login100-form {
width: 100%;
}
.login100-form-title {
font-family: Ubuntu-Bold;
font-size: 30px;
color: #403866;
line-height: 1.2;
text-transform: uppercase;
text-align: center;
width: 100%;
display: block;
}
/*==================================================================
[ Restyle Select2 ]*/
.select2-container {
display: block;
max-width: 100% !important;
width: auto !important;
}
.select2-container .select2-selection--single {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
align-items: center;
background-color: rgba(171, 171, 189, 0.233);
border: none;
height: 40px;
outline: none;
position: relative;
left: -40px;
}
/*------------------------------------------------------------------
[ in select ]*/
.select2-container .select2-selection--single .select2-selection__rendered {
font-family: Ubuntu-Bold;
font-size: 18px;
color: #555555;
line-height: 1.2;
padding-left: 0px ;
background-color: transparent;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 100%;
top: 50%;
transform: translateY(-50%);
right: 0px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
align-items: center;
justify-content: flex-end;
}
.select2-selection__arrow b {
display: none;
font-family: Material-Design-Iconic-Font !important;
font-size: 18px;
color: #555555;
}
.select2-selection__arrow {
content: '\f312';
font-family: Material-Design-Iconic-Font !important;
font-size: 18px;
color: #555555;
}
/*------------------------------------------------------------------
[ Dropdown option ]*/
.select2-container--open .select2-dropdown {
z-index: 1251;
width: calc(100% + 2px);
border: 0px solid transparent;
border-radius: 10px;
overflow: hidden;
background-color: rgba(171, 171, 189, 1);
left: -40px;
box-shadow: 0 3px 10px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 3px 10px 0px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 3px 10px 0px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 3px 10px 0px rgba(0, 0, 0, 0.2);
-ms-box-shadow: 0 3px 10px 0px rgba(0, 0, 0, 0.2);
}
#media (max-width: 576px) {
.select2-container--open .select2-dropdown {
left: -12px;
}
}
.select2-dropdown--above {top: -38px;}
.select2-dropdown--below {top: 10px;}
.select2-container .select2-results__option[aria-selected] {
padding-top: 10px;
padding-bottom: 10px;
padding-left: 24px;
}
#media (max-width: 576px) {
.select2-container .select2-results__option[aria-selected] {
padding-left: 12px;
}
}
.select2-container .select2-results__option[aria-selected="true"] {
background: #403866;
color: white;
}
.select2-container .select2-results__option--highlighted[aria-selected] {
background: #827ffe;
color: white;
}
.select2-results__options {
font-family: Ubuntu-Bold;
font-size: 14px;
color: #555555;
line-height: 1.2;
}
.select2-search--dropdown .select2-search__field {
border: 1px solid #aaa;
outline: none;
font-family: Ubuntu-Bold;
font-size: 15px;
color: #333333;
line-height: 1.2;
}
.wrap-input100 .dropDownSelect2 .select2-container--open {
width: 100% !important;
}
.wrap-input100 .dropDownSelect2 .select2-dropdown {
width: calc(100% + 2px) !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Blackfynn Exporter</title>
<meta charset="UTF-8">
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id='blackfynn-panel' style="position: relative;">
<div class="dat-gui-container"></div>
<div class="container-login100 datasetUI" id="dataset_div">
<div class="wrap-data100 p-t-5 p-b-5 datasetUI">
<form class="contact100-form validate-form">
<span class="login100-form-title">
Data Viewer
</span>
<div class=" input100 wrap-input100 input100-select bg1 datasetUI">
<span class="label-input100"></span>
<div id="channel_div">
<select class="js-select2" name="service" id="select_channel">
<option>Channel Selection</option>
</select>
<div class="dropDownSelect2"></div>
</div>
</div>
</form>
<br>
<div id="exportURL">
</div>
</div>
</div>
<div class="datasetUI" id="chart_div"></div>
</div>
</body>
</html>
If you have a look at the snippet you see that .dat-gui-container has position: absolute set. In your case you have to set position absolute to the element that gets animated, thus preventing the rest of the elements from moving around.