I am currently trying to achieve this effect:
and I have gotten very close, Here's what I have so far:
JSFIDDLE DEMO
CSS:
.block {
margin-top: 1em;
position: relative;
overflow: auto;
height: 100%;
width: 100%;
float: left;
}
.icon {
background: #000000;
display: inline-block;
height: 50px;
width: 112px;
}
.line {
position: absolute;
background: #000099;
width: 100%;
height: 1px;
z-index: -1;
top: 50%;
left: 0;
margin-left: -416px;
}
.text {
/*background: #004746;*/
display: inline-block;
position: relative;
vertical-align: middle;
max-width: 400px;
float: right;
border-left: 1px solid #000099;
padding-left: 1em;
}
.text:after {
content:"";
background: #000099;
position: absolute;
bottom: 0;
left: 0;
width: 1em;
height: 1px;
}
.text:before {
content:"";
background: #000099;
position: absolute;
top: 0;
left: 0;
width: 1em;
height: 1px;
}
.text p {
padding: 0 0 1em 0;
}
.text p:last-child {
margin: 0;
}
HTML:
<div class="block">
<div class="icon"></div>
<div class="line"></div>
<div class="text">
<p>Lorem ipsum dolor sit amet, pri eu liber utroque quaestio, ei dicta quaeque sed. Civibus omnesque concludaturque vim eu, ex his nostro quodsi, graecis commune posidonium mei ad. Nam facilis alienum fastidii te, te quando euripidis usu. Torquatos consetetur suscipiantur mel eu, duo cu impedit feugait.</p>
<p>Vocibus urbanitas suscipiantur pro ut, cu nisl nobis nonumy mel. Posse omnes urbanitas usu in, nusquam invidunt ad sed, mucius recusabo has ea. Aliquip voluptua ius eu, ex vix justo mundi, indoctum scripserit mei cu. Te sit tantas albucius probatus.</p>
</div>
</div>
My only problem is the box on the left ("icon"), needs to vertically align with the line that runs through. But the box can not be position absolute.
RULES:
Has to be responsive.
Needs to work from IE8 up.
Needs to account for the fact that the text on the right is dynamic and could grow or shrink.
add this code to your .icon class:
.icon {
position: absolute;
top: 50%;
margin-top: -25px;
}
Related
Here is my Html. I want to fix my nav item on top on scrolling using html and css I tried a lot of things but I was not able to fix it. How can I build it without JavaScript or jQuery?
<div class="contain">
<p>
Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones
no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae
gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec
et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.
</p>
</div>
<nav>
<div class="navWide">
<div class="wideDiv">
Link 1
Link 2
Link 3
</div>
</div>
<div class="navNarrow">
<i class="fa fa-bars fa-2x"></i>
<div class="narrowLinks hidden">
Link 1
Link 2
Link 3
</div>
</div>
</nav>
<div class="contain">
<p>
Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones
no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae
gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec
et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.
</p>
</div>
My custom CSS using this. How can I fix my problem? It will be really helpful for me and others too why I want to complete this using CSS. I am making a small component using html and CSS, this is one more component and I got stuck here.
.contain{
height:100vh;
backgroud:#ccc;
}
nav {
background-color: #CCC;
overflow: hidden;
padding: 1em;
border-bottom: 1px solid #000;
}
nav a {
color: #000;
}
nav a:visited {
color: #000;
}
nav .navWide {
display: none;
margin: 0 auto;
}
nav .navWide .wideDiv {
text-align: center;
}
nav .navWide .wideDiv a {
text-decoration: none;
display: inline-block;
padding: 0 2em;
}
nav .navNarrow i {
float: left;
cursor: pointer;
color: #000;
}
nav .navNarrow .narrowLinks a {
text-decoration: none;
display: block;
float: left;
clear: left;
padding: 0.5em 0;
}
.hidden {
display: none;
}
/*Adjust breakpoint as desired to select when the "hamburger" menu is
replaced by just the links.*/
#media (min-width: 480px) {
nav .navWide {
display: block;
}
nav .navNarrow {
display: none;
}
}
You could use position: sticky; on your nav, but note that it will not be supported on all browsers (for example IE 11). Here is the compatibility chart if you wanna take a look: https://caniuse.com/#feat=css-sticky
A safer fix is to set position: fixed; to you nav, and give your content some top padding.
So your css will be as follows:
body {
margin: 0;
}
.contain{
height:100vh;
background:#ccc;
padding-top: 50px;
}
nav {
background-color: #CCC;
overflow: hidden;
padding: 1em;
border-bottom: 1px solid #000;
position: fixed;
top: 0px;
display: block;
width: 100%;
}
nav a {
color: #000;
}
nav a:visited {
color: #000;
}
nav .navWide {
display: none;
margin: 0 auto;
}
nav .navWide .wideDiv {
text-align: center;
}
nav .navWide .wideDiv a {
text-decoration: none;
display: inline-block;
padding: 0 2em;
}
nav .navNarrow i {
float: left;
cursor: pointer;
color: #000;
}
nav .navNarrow .narrowLinks a {
text-decoration: none;
display: block;
float: left;
clear: left;
padding: 0.5em 0;
}
.hidden {
display: none;
}
/*Adjust breakpoint as desired to select when the "hamburger" menu is
replaced by just the links.*/
#media (min-width: 480px) {
nav .navWide {
display: block;
}
nav .navNarrow {
display: none;
}
}
You can actually use a simple
position: sticky;
top: 0;
Sticky behavior will apply once nav bar hits top position 0.
.contain{
height:100vh;
backgroud:#ccc;
}
nav {
background-color: #CCC;
overflow: hidden;
padding: 1em;
border-bottom: 1px solid #000;
position: sticky;
top: 0;
}
nav a {
color: #000;
}
nav a:visited {
color: #000;
}
nav .navWide {
display: none;
margin: 0 auto;
}
nav .navWide .wideDiv {
text-align: center;
}
nav .navWide .wideDiv a {
text-decoration: none;
display: inline-block;
padding: 0 2em;
}
nav .navNarrow i {
float: left;
cursor: pointer;
color: #000;
}
nav .navNarrow .narrowLinks a {
text-decoration: none;
display: block;
float: left;
clear: left;
padding: 0.5em 0;
}
.hidden {
display: none;
}
/*Adjust breakpoint as desired to select when the "hamburger" menu is
replaced by just the links.*/
#media (min-width: 480px) {
nav .navWide {
display: block;
}
nav .navNarrow {
display: none;
}
}
<div class="contain">
<p>
Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones
no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae
gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec
et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.
</p>
</div>
<nav>
<div class="navWide">
<div class="wideDiv">
Link 1
Link 2
Link 3
</div>
</div>
<div class="navNarrow">
<i class="fa fa-bars fa-2x"></i>
<div class="narrowLinks hidden">
Link 1
Link 2
Link 3
</div>
</div>
</nav>
<div class="contain">
<p>
Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones
no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae
gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec
et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.
</p>
</div>
As stated, the way to go is:
body {
height: 100vh;
overflow-y: auto
}
.nav {
position: sticky;
top: 20px;
}
As for 'not working in all browsers' that's a whole different story. If you really want to go through that, here's a good starting point:
You could use an onscroll eventListener to check the position of the nav, in relation to the screen, with getBoundingClientRect() - but it is much more expensive than the sticky implementation.
.makeItFixed {
position: fixed;
top: 0; left: 0;
};
var nav = document.getElementsByTgName('nav')[0];
window.addEventListener('scroll', function(){
if (nav.getBoundingClientRect().top <= 0) {
nav.classList.add('makeItFixed');
} else {
nav.classList.remove('makeItFixed');
}
});
This could use some proper optimization, including a debouncing interval, and eventually moving the getBoundingClientRect() outside of the check - it is an expensive operation as it causes a page reflow/layout with every call.
In the future, the intersectionObserver API will take over, but as you wanted it to work in 'all' browsers, this is out of the question.
I'm about to finish my first web project and when I'm checking the browsers I find that firefox causes me the following error in the footer.
view Chrome:
view Firefox:
As you can see in other browsers it works and it looks perfectly in firefox, it is the only one that creates that space for me, if you can help me I would appreciate it. Here is the code:
footer
{
position: absolute;
top: 2050px;
height: 330px;
}
footer div#aboutme
{
width: 50%;
height: 300px;
margin: 0px;
padding-bottom: 0px;
}
footer div#aboutme h3
{
width: 80%;
margin-left: 10%;
padding-top: 20px;
}
footer div#aboutme p
{
width: 80%;
margin-left: 10%;
padding-top: 15px;
}
footer div.rrss
{
position: relative;
width: 50%;
height: 150px;
margin: 0px;
top: -300px;
left: 50%;
padding-bottom: 0px;
}
footer div.rrss p
{
padding-top: 30px;
}
footer div.rrss a
{
padding-top: 15px;
}
footer div.suscription
{
position: relative;
width: 50%;
height: 150px;
margin: 0px;
top: -300px;
margin-left: 50%;
padding-bottom: 0px;
text-align: center;
}
footer div.suscription p
{
display: block;
padding-top: 0px;
padding-bottom: 30px;
}
footer div.suscription input:nth-of-type(1)
{
max-width: 175px;
}
footer div.suscription input:nth-of-type(2)
{
max-width: 125px;
border: none;
border-bottom: 1px solid white;
}
footer div#derechos
{
position: relative;
top: -299px;
}
footer div#derechos p
{
position: relative;
top: 15px;
}
<footer>
<div id="aboutme">
<h3>Acerca de mí...</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="rrss">
<p><strong>Encuentrame en:</strong></p>
</div>
<div class="suscription">
<p>Recibe nuestras publicaciones en tu email.</p>
<input type="mail" name="email" placeholder="Ingresa tu email" id="input_registro">
<input type="button" id="button_registro" name="button_registro" value="Registrar">
</div>
<div id="derechos">
<p>© 2018 All rights reserved | Privacity Policy</p>
</div>
</footer>
this is where comes from your trouble :
footer div.rrss
{
position: relative;
width: 50%;
height: 150px;
margin: 0px;
top: -300px;
left: 50%;
padding-bottom: 0px;
}
Firefox moves it up at screen but does not free that space.
add overflow:hidden to footer to keep it 300px of height
footer
{
position: absolute;
top: 2050px;
height: 330px;
overflow:hidden; /* will not keep space used by the relative element */
}
footer div#aboutme
{
width: 50%;
height: 300px;
margin: 0px;
padding-bottom: 0px;
}
footer div#aboutme h3
{
width: 80%;
margin-left: 10%;
padding-top: 20px;
}
footer div#aboutme p
{
width: 80%;
margin-left: 10%;
padding-top: 15px;
}
footer div.rrss
{
position: relative;
width: 50%;
height: 150px;
margin: 0px;
top: -300px;
left: 50%;
padding-bottom: 0px;
}
footer div.rrss p
{
padding-top: 30px;
}
footer div.rrss a
{
padding-top: 15px;
}
footer div.suscription
{
position: relative;
width: 50%;
height: 150px;
margin: 0px;
top: -300px;
margin-left: 50%;
padding-bottom: 0px;
text-align: center;
}
footer div.suscription p
{
display: block;
padding-top: 0px;
padding-bottom: 30px;
}
footer div.suscription input:nth-of-type(1)
{
max-width: 175px;
}
footer div.suscription input:nth-of-type(2)
{
max-width: 125px;
border: none;
border-bottom: 1px solid white;
}
footer div#derechos
{
position: relative;
top: -299px;
}
footer div#derechos p
{
position: relative;
top: 15px;
}
<footer>
<div id="aboutme">
<h3>Acerca de mí...</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="rrss">
<p><strong>Encuentrame en:</strong></p>
</div>
<div class="suscription">
<p>Recibe nuestras publicaciones en tu email.</p>
<input type="mail" name="email" placeholder="Ingresa tu email" id="input_registro">
<input type="button" id="button_registro" name="button_registro" value="Registrar">
</div>
<div id="derechos">
<p>© 2018 All rights reserved | Privacity Policy</p>
</div>
</footer>
You may also consider grid for the layout of the footer :
footer {
position: absolute;
top: 2050px;
height: 350px;
display: grid;
grid-template-columns: 1fr 1fr;
background: #444;
color: white;
}
footer div#aboutme {
grid-column: 1;
grid-row: 1 / span 2;
}
footer div#aboutme h3 {
width: 80%;
margin-left: 10%;
padding-top: 20px;
}
footer div#aboutme p {
width: 80%;
margin-left: 10%;
padding-top: 15px;
}
footer div.rrss {
grid-column: 2;
grid-row: 1;
}
footer div.rrss p {
padding-top: 30px;
}
footer div.rrss a {
padding-top: 15px;
}
footer div.suscription {
grid-column: 2;
grid-row: 2;
}
footer div.suscription p {
display: block;
padding-top: 0px;
padding-bottom: 30px;
}
footer div.suscription input:nth-of-type(1) {
max-width: 175px;
}
footer div.suscription input:nth-of-type(2) {
max-width: 125px;
border: none;
border-bottom: 1px solid white;
}
footer div#derechos {
grid-row: 3;
grid-column: 1 / span 2;
margin: auto;
}
footer div#derechos p {}
<footer>
<div id="aboutme">
<h3>Acerca de mí...</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="rrss">
<p><strong>Encuentrame en:</strong></p>
</div>
<div class="suscription">
<p>Recibe nuestras publicaciones en tu email.</p>
<input type="mail" name="email" placeholder="Ingresa tu email" id="input_registro">
<input type="button" id="button_registro" name="button_registro" value="Registrar">
</div>
<div id="derechos">
<p>© 2018 All rights reserved | Privacity Policy</p>
</div>
</footer>
Reference images:
Required
Current
Bottom is my work, top is my goal or as close to as possible.
I have two questions, why won't my div go to the right side of the page?
and
I'm having trouble filling in h1 and div with colour and a boarder any help would
be appreciated
Here is my code that i've been working on, sorry im new to CSS and html still.
body {
background-image: url("bg.jpg");
}
div { background-color; #cccccc;
opacity: 0.8;
padding: 5px;
width: 200px;
height: 200px;
border: 3px ridge #cccccc;
padding: 5px
margin: 10px
position:absolute;
right: 0%;
top: 0%;
}
h1
{ background-color; #cccccc;
padding: 5px;
font-weight: bold;
font-size: 40px;
text-align: center
opacity: 0.8;
position:absolute;
left: 45%;
top: 60%;
font-family,sans-serif
width: 300px;
}
</style>
</head>
<body>
<header id="header">
<div class="h1">
<h1 style="color:DarkSlateBlue" text-align: center;>Rythm and Blues</h1>
</div>
<div>
<div class="div">
<h3 style="color:DarkSlateBlue" text-align: center> Artist Name</h3>
<p style="color:DarkSlateBlue"> Lorem ipsum dolor sit amet, suas utinam numquam mea ea, errem neglegentur eum ut. Aliquam
reformidans et mel. soleat corpora prodesset id quo. ei cibo natum delenit his.</p>
</div>
</body>
Wouldn't fit in comments. Below is some fixes to your syntax.
<style>
body {
background-image: url("bg.jpg");
}
.div {
background-color: #cccccc;
opacity: 0.8;
width: 200px;
height: 200px;
border: 3px ridge #cccccc;
padding: 5px;
margin: 10px;
position:absolute;
right: 0%;
top: 0%;
}
.h1
{ background-color: #cccccc;
font-weight: bold;
font-size: 40px;
text-align: center;
opacity: 0.8;
position:absolute;
left: 45%;
top: 60%;
font-family,sans-serif;
width: 300px;
}
</style>
</head>
<body>
<div class="h1">
<h1 style="color:DarkSlateBlue;text-align: center;">Rythm and Blues</h1>
</div>
<div class="div">
<h3 style="color:DarkSlateBlue" text-align: center> Artist Name</h3>
<p style="color:DarkSlateBlue"> Lorem ipsum dolor sit amet, suas utinam numquam mea ea, errem neglegentur eum ut. Aliquam
reformidans et mel. soleat corpora prodesset id quo. ei cibo natum delenit his.</p>
</div>
</body>
I'm having this problem with a page I'm creating.screenshot
Here is the code for the html:
<!DOCTYPE html>
<head>
<meta charset="UTF-8"/>
<title>JJ TECH</title>
<link rel="stylesheet" href="_css/estilo.css"/>
</head>
<body>
<div id="interface">
<header id="cabecalho">
<nav id="menu">
<h1>Menu Principal</h1>
<ul>
<li>Home</li>
<li>Informações</li>
<li>Contato</li>
</ul>
</nav>
</header>
<p>Lorem ipsum dolor sit amet, elit ferri facilisi has an, eos probatus perpetua maluisset ad. Minim ponderum pro ut, cu vim referrentur philosophia, ex posse causae signiferumque mei. Dico erant veniam sea et, ut elitr ponderum delicata sed. Tation euismod vix ex, usu latine omnesque no. Vel no libris maiestatis.</p>
</div>
</body>
and css:
#charset "UTF-8";
body{
font-family: Arial, sans-serif;
background: #370b44;
}
div#interface{
width: 900px;
background: #fff;
margin: -20px auto 0 auto;
padding: 20px;
}
p{
text-align: justify;
text-indent: 30px;
}
/*CONFIGURAÇÃO DO MENU*/
nav#menu h1{
display: none;
}
nav#menu ul{
background-color: rgba(0,0,0,.5);
overflow: hidden;
list-style: none;
display: block;
font-size: 13pt;
margin: 0;
padding: 0;
position: fixed;
width: 100%;
top: 0;
left: 0;
}
nav#menu li{
float: left;
/*border-right: 1px solid #555;*/
}
nav#menu li:hover:not(.active){
background: #000;
}
a{
display: block;
text-decoration: none;
color: #fff;
padding: 15px;
}
.ativo{
background: #751891;
}
How can I make my content come after my menu, not under it?
Since your navigation is position fixed, you have to push down the content using padding or margin. First set body margin to 0. Then add padding-top: 60px; to div#interface. That should be a good starter. And of course try to learn something about block elements, inline elements, floating elements and check their different behavior regarding layouting.
You need to update your css for div#interface
div#interface{
width: 900px;
background: #fff;
margin: 67px auto 0 auto;
padding-top: 20px;
}
I hope this may help:
Change it according to your requirements. Especially add style in separate file.
You need to shuffle your HTML markup and add position fixed to div#interface I suggest change its width to 100%
here is the working code:
<head>
<meta charset="UTF-8"/>
<title>JJ TECH</title>
<style>
body{
font-family: Arial, sans-serif;
background: #370b44;
}
div#interface{
width: 900px;
background: #fff;
margin: -20px auto 0 auto;
padding: 20px;
position:fixed;
top:71px;
}
p{
text-align: justify;
text-indent: 30px;
}
/*CONFIGURAÇÃO DO MENU*/
nav#menu h1{
display: none;
}
nav#menu ul{
background-color: rgba(0,0,0,.5);
overflow: hidden;
list-style: none;
display: block;
font-size: 13pt;
margin: 0;
padding: 0;
position: fixed;
width: 100%;
top: 0;
left: 0;
}
nav#menu li{
float: left;
/*border-right: 1px solid #555;*/
}
nav#menu li:hover:not(.active){
background: #000;
}
a{
display: block;
text-decoration: none;
color: #fff;
padding: 15px;
}
.ativo{
background: #751891;
}
</style>
</head>
<body>
<header id="cabecalho">
<nav id="menu">
<h1>Menu Principal</h1>
<ul>
<li>Home</li>
<li>Informações</li>
<li>Contato</li>
</ul>
</nav>
</header>
<div id="interface">
<p>Lorem ipsum dolor sit amet, elit ferri facilisi has an, eos probatus perpetua maluisset ad. Minim ponderum pro ut, cu vim referrentur philosophia, ex posse causae signiferumque mei. Dico erant veniam sea et, ut elitr ponderum delicata sed. Tation euismod vix ex, usu latine omnesque no. Vel no libris maiestatis.</p>
</div>
</body>
I want my HTML/CSS to match what it does in the following picture:
This is currently what my HTML/CSS looks like:
There are four things that I am having issues with in my HTML/CSS that the picture is currently doing:
Align the text to the right of the checkbox in such a way that no text appears directly below the checkbox
Make the two buttons in the picture the same size
Make the two buttons centered according to the white text paragraph above
I can't seem to do #2 and #3 at the same time.
Any other discrepancies between the two pictures can be ignored.
How do I accomplish items 1-4 as mentioned above?
This is the plunker link: http://plnkr.co/edit/dfZg2C1ZrqdeSdoBa21t?p=preview
This is the HTML code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div id="LoadingDiv">
<div class="LoadingText">
<p style="color:red"><strong>Attention! You must agree to continue with Online Forms</strong></p>
<p><input type="checkbox"/>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="btn-group">
<button class="btn btn-dont-allow">DON'T ALLOW</button>
<button class="btn btn-consent-ok">OK</button>
</div>
</div>
</div>
</body>
</html>
This is the CSS:
#LoadingDiv .btn {
min-width: 30%;
}
#LoadingDiv .btn-group {
margin-left:35%;
position: relative;
}
#LoadingDiv .LoadingText {
position: relative;
left: 25%;
top: 25%;
width: 50%;
color: white;
}
#LoadingDiv .btn-dont-allow {
background-color: #808083;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv .btn-consent-ok {
background-color: #1aa8de;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv {
margin: 0px 0px 0px 0px;
position: fixed;
padding: 0;
margin: 0;
top: 0;
left: 0;
height: 100%;
z-index: 9999;
width: 100%;
clear: none;
background-color: rgba(68, 176, 129, 0.9);
}
P.S: The markup in this picture was not created using HTML/CSS, but a prototyping app, so I can't just extract it from its source.
See this fiddle https://jsfiddle.net/DIRTY_SMITH/avocyf33/7/
added this
p {
display: block;
padding-left: 15px;
text-indent: -15px;
}
input {
width: 13px;
height: 13px;
padding: 0;
margin:0;
vertical-align: bottom;
position: relative;
top: -1px;
}
and added min-width: 400px; to btn-group to keep buttons from wrapping.
Jsfiddle
#LoadingDiv .btn {
min-width: 30%;
}
#LoadingDiv .btn-group {
display: inline-block;
}
#LoadingDiv .LoadingText {
position: relative;
left: 25%;
top: 25%;
width: 50%;
color: white;
}
#LoadingDiv .btn-dont-allow {
background-color: #808083;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv .btn-consent-ok {
background-color: #1aa8de;
color: #ffffff;
padding: 3px 50px;
font-size: 16px;
margin-left: 3px;
margin-right: 3px;
}
#LoadingDiv {
margin: 0px 0px 0px 0px;
position: fixed;
padding: 0;
margin: 0;
top: 0;
left: 0;
height: 100%;
z-index: 9999;
width: 100%;
clear: none;
background-color: rgba(68, 176, 129, 0.9);
}
.check {
width: 15px;
height: 15px;
padding: 0;
margin: 0;
vertical-align: bottom;
position: relative;
top: -3px;
}
.agree {
display: inline-block;
margin-left: 30px;
margin-top: -22px;
vertical-align: top;
}
<body>
<div id="LoadingDiv">
<div class="LoadingText">
<p style="color:red"><strong>Attention! You must agree to continue with Online Forms</strong>
</p>
<input type="checkbox" class="check">
<p class="agree">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="btn-group">
<button class="btn btn-dont-allow">DON'T ALLOW</button>
<button class="btn btn-consent-ok">OK</button>
</div>
</div>
</div>
</body>
</html>