Opacity of inline-block - html

I want to show a number of text blocks, at first just showing the title and a few lines, and after clicking a 'more' tag show it all, or hide it again.
I used the CSS trick of hidden checkbox and label, and it looked almost correct.
label {
width: 50%;
border-radius: 5px;
background: linear-gradient(to bottom, rgba(255,255,255,0.0) 0%, rgba(0,0,128,0.7) 100%);
cursor: pointer;
}
label:after {
content: "see more...";
margin-left: 1%;
font-style: italic;
font-weight: bold;
font-size: smaller;
}
.lbl1 {
// display:inline-block;
padding-top: 40px;
color: white;
font-style: italic;
}
input[id^="more"] {
display: none;
}
input[id^="more"]:checked ~ .lbl1:after {
content: "show less";
}
input[id^="more"]:checked ~ .arttxt1{
height: 100%;
}
.arttxt1{
margin-left:1%;
width: 50%;
margin-bottom:2px;
line-height: 2.5ex;
height: 8.4ex; /* 2.5ex for each visible line */
overflow: hidden;
}
<article>
<h1>De regels</h1>
<input id='more20' type='checkbox'/>
<div class='arttxt1'>
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.</div>
<label for='more20' class='lbl1'> </label>
</article>
The label to click on only had the width of the text, whereas I wanted it streteched over the full width.
Searching suggested adding 'display: inline-block' which I did. It indeed stretched the label over the full width, but I also lost the transparency: it sort of lies in front of the text.
I tried and I searched but could not find a proper solution. Hope someone can help me.

Is this the effect you want?
using negative margin to move div up
label {
width: 50%;
border-radius: 5px;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0.0) 0%, rgba(0, 0, 128, 0.7) 100%);
cursor: pointer;
}
label:after {
content: "see more...";
margin-left: 1%;
font-style: italic;
font-weight: bold;
font-size: smaller;
}
.lbl1 {
display: inline-block;
padding-top: 40px;
color: white;
font-style: italic;
margin-top: -40px;
padding-left: 1%;
}
input[id^="more"] {
display: none;
}
input[id^="more"]:checked~.lbl1:after {
content: "show less";
}
input[id^="more"]:checked~.arttxt1 {
height: 100%;
}
.arttxt1 {
margin-left: 1%;
width: 50%;
margin-bottom: 2px;
line-height: 2.5ex;
height: 8.4ex;
/* 2.5ex for each visible line */
overflow: hidden;
}
<article>
<h1>De regels</h1>
<input id='more20' type='checkbox' />
<div class='arttxt1'>
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.</div>
<label for='more20' class='lbl1'> </label>
</article>

To clarify, it doesn't lose the transparency - what is actually happening is that because your <div class="arttxt1"> is a block element, the label is being pushed down to below the text.
As such, you can either use margin-top as per Chris Li's answer, or position:relative and top to push the label up over the top of your text.
label {
width: 50%;
border-radius: 5px;
background: linear-gradient(to bottom, rgba(255,255,255,0.0) 0%, rgba(0,0,128,0.7) 100%);
cursor: pointer;
}
label:after {
content: "see more...";
margin-left: 1%;
font-style: italic;
font-weight: bold;
font-size: smaller;
}
.lbl1 {
display:inline-block;
padding-top: 40px;
color: white;
font-style: italic;
position:relative;
top: -40px;
}
input[id^="more"] {
display: none;
}
input[id^="more"]:checked ~ .lbl1:after {
content: "show less";
}
input[id^="more"]:checked ~ .arttxt1{
height: 100%;
}
.arttxt1{
margin-left:1%;
width: 50%;
margin-bottom:2px;
line-height: 2.5ex;
height: 8.4ex; /* 2.5ex for each visible line */
overflow: hidden;
}
<article>
<h1>De regels</h1>
<input id='more20' type='checkbox'/>
<div class='arttxt1'>
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.</div>
<label for='more20' class='lbl1'> </label>
</article>

Related

Superimpose 2 DIV

I want realise this page
this is my work
the probleme is i can't superimpose the div who contain the text "LUCETTE" under the div who contain the picture
my code html:
* {
font-size: 16px;
font-family: 'playfair_displayblack';
}
.container {
position: relative;
}
.central {
display: flex;
width: 66vw;
height: 55vh;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, 50%);
z-index: 2;
}
.left {
flex: 1;
}
.right {
flex: 2;
background-color: #2b563b;
overflow: hidden;
}
.belle {
max-width: 100%;
max-height: 100%;
display: block;
border: 9px solid whitesmoke;
}
.bas {
display: flex;
flex-direction: row;
}
.pied {
bottom: 100px;
width: 90vw;
height: 30vh;
margin-left: auto;
margin-right: auto;
}
.titre span {
text-align: center;
text-transform: uppercase;
font-size: 16rem;
font-weight: bolder;
font-family: 'playfair_displayitalic';
position: absolute;
bottom: 0;
z-index: -1;
}
<main class="container">
<div class="central">
<div class="left">
<img src="images/chantal.jpg" alt="" class="belle">
</div>
<div class="right">
<section>
<header>
<h1> <span>strategy</span> </h1>
</header>
<p>
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>
<p>
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>
</section>
</div>
</div>
<div class="pied">
<h1 class="titre"> <span>lucette</span> </h1>
</div>
</main>
THANKS .
i'm tryng to superimpose the div who contain the image on top of the div who contain the text "LUCETTE".
but the text "LUCETTE" is on the top of my page .
Try this:
* {
font-size: 16px;
font-family: 'playfair_displayblack';
}
.container {
position: relative;
padding-top: 100px;
height: 100vh;
display: flex;
justify-content: center;
}
.central {
display: flex;
width: 66vw;
height: 55vh;
z-index: 2;
}
.left {
flex: 1;
}
.right {
flex: 2;
background-color: #2b563b;
overflow: hidden;
}
.belle {
max-width: 100%;
max-height: 100%;
display: block;
border: 9px solid whitesmoke;
}
.bas {
display: flex;
flex-direction: row;
}
.pied {
bottom: 100px;
width: 90vw;
height: 30vh;
margin-left: auto;
margin-right: auto;
}
.pied {
font-weight: bolder;
font-family: serif;
position: absolute;
width: 0px;
overflow: visible;
bottom: 35%;
left: 50%;
}
.pied h1 {
position: absolute;
text-align: center;
text-transform: uppercase;
font-size: 16rem;
transform: translate(-50%, 0);
font-family: 'playfair_displayitalic';
top: 0;
left: 50%;
}
<main class="container">
<div class="central">
<div class="left">
<img src="images/chantal.jpg" alt="" class="belle">
</div>
<div class="right">
<section>
<header>
<h1> <span>strategy</span> </h1>
</header>
<p>
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>
<p>
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>
</section>
</div>
</div>
<div class="pied"><h1>lucette</h1></div>
</main>
Mind the fact that you might need to tweak the bottom attribute of .pied as I did not have that font.
Main issue in your code was that you didn't set position: absolute for the main container of the text. I did some tweaks to ensure that text is also centered etc.
Using absolute position removes items from the normal flow of the page, and can often lead to isolation and z-index mistakes.
I'm attaching a method using a grid layout to superimpose items. Grids are usually easier to debug.
Just to be clear absolute positions can be used, this is just an alternative.
section {
display: grid;
}
.behind {
height: 5rem;
width: 5rem;
background-color: red;
grid-area: 1 / 1;
}
.front {
height: 3rem;
width: 3rem;
background-color: blue;
/* Can also use grid-area */
grid-column: 1;
grid-row: 1;
}
<section>
<div class="behind"></div>
<div class="front"></div>
</section>
enter image description here
Now the result is better but the problem now i want move the bloc center ho contain the picture and the texte in the the middle on the page but i can 't

My responsive menu does not display correctly on hover and the menu contents are transparent

I have a problem with my responsive menu when I switch to a very small window I have my menu displayed but have seen the contents of the page suddenly impossible to click on the links.
So I can't find where I made a mistake.
Thank you...
$(document).ready(function() {
let menu = $('#menu');
let navegation = $('#navegation');
let scrollZero = 0;
$('#icon-menu').on('click', function() {
$(this).toggleClass('fa-times fa-bars');
$('body').toggleClass('no-scroll-y');
navegation.toggleClass('menu-active');
});
$('.submenu').on('click', function() {
$(this).siblings('.submenu').children('.children').slideUp();
$(this).siblings('.submenu').children('a').children('.caret').removeClass('rotate');
$(this).children('a').children('.caret').toggleClass('rotate');
$(this).children('.children').slideToggle();
});
$(window).on('click', function(e) {
if (menu.has(e.target).length == 0 && !menu.is(e.target)) {
$('.submenu').children('.children').slideUp();
$('.submenu').children('a').children('.caret').removeClass('rotate');
if ($(this).width() < 900 && navegation.hasClass('menu-active')) {
$('#icon-menu').trigger('click');
}
}
});
$(window).on('load scroll resize', function () {
let positionScrollY = $(window).scrollTop();
if (positionScrollY < scrollZero) {
menu.removeClass('scroll-down');
} else {
$('.submenu').children('.children').slideUp();
$('.submenu').children('a').children('.caret').removeClass('rotate');
menu.addClass('scroll-down');
}
scrollZero = positionScrollY;
if (positionScrollY == 0) {
menu.removeClass('scroll-down');
}
});
$(window).on('resize', function() {
$('body').removeClass('no-scroll-y');
if ($(this).width() > 900 && !navegation.hasClass('menu-active')) {
$('#icon-menu').addClass('fa-bars').removeClass('fa-times');
navegation.removeClass('menu-active');
} else if ($(this).width() < 900 && navegation.hasClass('menu-active')) {
$('body').addClass('no-scroll-y');
}
});
});
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
*:focus {
outline: 0;
}
html {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
background-color: #fefefe;
}
a {
text-decoration: none;
}
/*------------------------------------*\
-------- Navigation
\*------------------------------------*/
.no-scroll-y {
overflow-y: hidden;
}
header {
background-color: #FFFFFF;
background-image: url("images/noise.png");
background-repeat: repeat;
width: 100%;
height: 54px;
}
.scroll-down,
.scroll-down .btn-menu {
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
.menu-bar {
display: none;
}
header nav::-webkit-scrollbar {
width: 7px;
}
header nav::-webkit-scrollbar-thumb {
background-color: rgba(77, 77, 77, 0.9);
box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.2) inset,
0 -1px 0 rgba(255, 255, 255, 0.2) inset;
}
header nav {
max-width: 1270px;
height: 54px;
margin: 0 auto;
}
.menu-active {
opacity: 1;
-webkit-transform: perspective(500px) rotateY(0deg);
transform: perspective(500px) rotateY(0deg);
}
header nav ul {
/*display: flex;
justify-content: space-around;*/
list-style: none;
}
header nav ul li {
display: inline-block;
position: relative;
}
header nav ul li a {
color: #1D3B6A;
display: block;
padding: 16px 10px;
font-family: 'Oswald';
font-size: 1.2rem;
}
header nav ul li a:hover {
color: #FC5342;
}
header nav ul li a:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
header nav ul li a:hover:before {
visibility: visible;
background-color: #1D3B6A;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
header nav ul li a span {
margin-right: 10px;
}
header nav ul li .caret {
margin: 0 0 0 10px;
position: relative;
-webkit-transition: 0.3s ease all;
transition: 0.3s ease all;
}
header nav ul li .caret.rotate {
-webkit-transform: rotateZ(-180deg);
transform: rotateZ(-180deg);
}
header nav ul li .children {
background-color: #FFFFFF;
padding: 10px;
border-radius: 5px;
position: absolute;
min-width: 280px;
right: 0;
top: 70px;
box-shadow: 0 2px 6px rgba(0,21,64,.1),0 10px 20px rgba(0,21,64,.05);
display: none;
-webkit-animation: children .4s cubic-bezier(.7,.006,.2,1);
animation: children .4s cubic-bezier(.7,.006,.2,1);
-webkit-transform-origin: top right;
transform-origin: top right;
z-index: 10000;
}
#-webkit-keyframes children {
from {
-webkit-transform: translateY(-1rem) scale(.9);
transform: translateY(-1rem) scale(.9);
opacity: 0;
}
to {
-webkit-transform: translateY(0) scale(1);
transform: translateY(0) scale(1);
opacity: 1;
}
}
#keyframes children {
from {
-webkit-transform: translateY(-1rem) scale(.9);
transform: translateY(-1rem) scale(.9);
opacity: 0;
}
to {
-webkit-transform: translateY(0) scale(1);
transform: translateY(0) scale(1);
opacity: 1;
}
}
/*
header nav ul li:hover .children,
header nav ul li:focus .children,
header nav ul li:active .children {
display: block;
}
*/
header nav ul li .children li {
display: block;
overflow: hidden;
}
header nav .right {
float: right;
}
header nav ul li .children li a {
display: block;
color: #828282;
font-size: 15px;
padding: 10px;
font-weight: 500;
font-family: Roboto;
}
header nav ul li .children li a:hover {
color: #AAB74E;
font-size: 15px;
}
header nav ul li .children li a span {
float: right;
font-size: 0.5em;
margin: 0 0 0 10px;
position: relative;
top: 5px;
}
/*------------------------------------*\
-------- Content
\*------------------------------------*/
.hita-main {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
max-width: 1270px;
}
#hita-top {
padding-top: 40px;
}
.hita-row {
margin-right: -15px;
margin-left: -15px;
}
.hita-m-1,
.hita-m-2,
.hita-m-3 {
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
margin-bottom: 25px;
}
/*------------------------------------*\
-------- Responsive ( Min )
\*------------------------------------*/
#media (min-width: 320px) {
.hita-main {
max-width: 460px;
}
}
#media (min-width: 576px) {
.hita-main {
max-width: 540px;
}
}
#media (min-width: 768px) {
.hita-main {
max-width: 720px;
}
}
#media (min-width: 992px) {
.hita-main {
max-width: 960px;
}
}
#media (min-width: 1280px) {
.hita-main {
max-width: 1270px;
}
.hita-m-1, .hita-m-2, .hita-m-3 {
float: left;
}
.hita-m-3 {
width: 100%;
}
.hita-m-2 {
width: 75%;
}
.hita-m-1 {
width: 25%;
}
}
/*------------------------------------*\
-------- Responsive ( Max )
\*------------------------------------*/
#media screen and (max-width: 900px) {
.menu-bar {
display: block;
width: 100%;
}
.menu-bar .btn-menu {
background-color: #FFFFFF;
background-image: url("images/noise.png");
background-repeat: repeat;
color: #193767;
cursor: auto;
display: block;
font: bold 25px 'Arial', sans-serif;
left: 0;
padding: 16px;
position: relative;
top: 0;
-webkit-transition: 0.3s ease all;
transition: 0.3s ease all;
width: 100%;
z-index: 1;
}
.menu-bar .btn-menu span {
cursor: pointer;
float: right;
font-size: 25px;
}
header nav {
height: calc(100% - 69px);
left: 0;
margin: 0;
opacity: 0;
overflow: auto;
position: fixed;
top: calc(70px - 1px);
-webkit-transform-origin: left;
transform-origin: left;
-webkit-transform: perspective(500px) rotateY(90deg);
transform: perspective(500px) rotateY(90deg);
-webkit-transition: 0.3s ease all;
transition: 0.3s ease all;
width: 80%;
background-color: #012345;
background-image: url("images/noise.png");
background-repeat: repeat;
}
header nav ul {
/*flex-direction: column;*/
}
header nav ul li {
border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
display: block;
}
header nav ul li .caret {
float: right;
}
header nav ul li .children {
display: none;
position: relative;
width: 100%;
top: 0;
border-radius: 0px;
background-color: #FFFFFF;
background-image: url("images/noise.png");
background-repeat: repeat;
}
header nav ul li:hover .children,
header nav ul li:focus .children,
header nav ul li:active .children {
display: none;
}
header nav ul li .children li a {
margin-left: 20px;
}
header nav .right {
float: left;
}
}
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - Menu dropdown</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.1/css/all.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.1/css/v4-shims.css">
</head>
<body>
<header id="menu">
<div class="menu-bar">
<a href="javascript:void(0);" class="btn-menu">
<span id="icon-menu" class="fa fa-bars"></span>
</a>
</div>
<nav id="navegation">
<ul>
<li><i class="fas fa-home"></i></li>
<li>Lorem</li>
<li>Lorem</li>
<li class="submenu">Lorem
<ul class="children">
<li>Lorem #1</li>
<li>Lorem #2</li>
<li>Lorem #3</li>
<li>Lorem #4</li>
<li>Lorem #5</li>
</ul>
</li>
<li class="submenu">Lorem
<ul class="children">
<li>Lorem #1</li>
<li>Lorem #2</li>
<li>Lorem #3</li>
<li>Lorem #4</li>
<li>Lorem #5</li>
</ul>
</li>
<li class="submenu">Lorem
<ul class="children">
<li>Lorem #1</li>
<li>Lorem #2</li>
<li>Lorem #3</li>
<li>Lorem #4</li>
<li>Lorem #5</li>
</ul>
</li>
<li class="right">Lorem</li>
</ul>
</nav>
</header>
<!-- +++++ Section - Content +++++ -->
<div class="hita-main" id="hita-top">
<div class="hita-row">
<div class="hita-m-2">
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
<br /><br />
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.
</div>
<!-- Menu Right -->
<div class="hita-m-1">
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.
</div>
</div>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
</body>
</html>
This is if someone could help me explain or I made a mistake thank you ...
Try to add z-index to the nav link in order to bring it to cover the div.
header nav ul li a {
color: #1D3B6A;
display: block;
padding: 16px 10px;
font-family: 'Oswald';
font-size: 1.2rem;
z-index: 1;
See https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
Thank you very much for your help I found my error I forgot the z-index but not where you told me but I found thank you...
header nav {
height: calc(100% - 69px);
left: 0;
margin: 0;
opacity: 0;
overflow: auto;
position: fixed;
top: calc(70px - 1px);
-webkit-transform-origin: left;
transform-origin: left;
-webkit-transform: perspective(500px) rotateY(90deg);
transform: perspective(500px) rotateY(90deg);
-webkit-transition: 0.3s ease all;
transition: 0.3s ease all;
width: 80%;
background-color: #012345;
background-image: url("images/noise.png");
background-repeat: repeat;
z-index: 1;
}

Wiggly paragraph and h2 after hover on button

When I hover on my button my H2 and paragraph wiggle. How can I prevent it? As you can see I would like to add more border during hovering. Is it a cause this situation?
.about-me-wrapper {
background-color: #fff;
width: 50%;
margin: 10em auto;
height: 50%;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.about-me-wrapper p {
width: 70%;
line-height: 1.75;
}
.about-me-wrapper a {
background: transparent;
border: 2px solid #000;
padding: 10px 20px;
margin: 20px 0;
font-weight: 700;
text-transform: uppercase;
transition: all .4s;
display: inline-block;
}
.about-me-wrapper a:hover {
cursor: pointer;
border: 3px solid #4EADFF;
color: #4EADFF;
transform: scale(1.1);
}
<section class="about-me">
<div class="about-me-wrapper">
<h2>Aarhus Lejerboliger</h2>
<p>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>
View project
</div>
</section>

how to adjust margin and padding using width with percentage?

So I want to achieve this using css and html
So I wrote this code that sets the width of each box to 33.33%
/* Base style */
h1 {
text-align: center;
}
.row {
width: 100%;
height: auto;
padding: 10px;
}
* {
box-sizing: border-box;
font-family: sans-serif;
margin: 0px;
}
div > div {
background-color: gray;
border: 1px solid;
float: left;
}
.dummy_text {
clear: right;
padding: 10px;
}
/* Top right paragraphs*/
#chiken {
float: right;
background-color: pink;
border: 2px solid;
width: 150px;
text-align: center;
font-weight: bold;
position: relative;
left: 1px;
padding: 5px;
}
#beef {
float: right;
background-color: indianred;
color: white;
border: 2px solid black;
width: 150px;
text-align: center;
font-weight: bold;
left: 1px;
padding: 5px;
}
#sushi {
float: right;
background-color: lightgoldenrodyellow;
border: 2px solid;
width: 150px;
text-align: center;
font-weight: bold;
left: 1px;
padding: 5px;
}
/* Desktop */
#media (min-width: 992px) {
.col-dsk-3 {
float: left;
width: 33.33%;
}
}
<h1>Our menu</h1>
<div class="row">
<div class="col-dsk-3 col-tbl-2 col-mbl-1">
<p id="chiken">Chicken
<p>
<p class="dummy_text">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>
<div class="col-dsk-3 col-tbl-2 col-mbl-1">
<p id="beef">Beef
<p>
<p class="dummy_text">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>
<div class="col-dsk-3 col-tbl-1 col-mbl-1">
<p id="sushi">Sushi
<p>
<p class="dummy_text">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>
</div>
And the result is this:
The thing is that I need spacing between paragraphs, so what I though was to add some margin-left to the boxes, the thing is that when I add 10px, the result is that one of the three boxes goes to a new line, but I need the three in the same line.
This is what I did to add the margin, I modify the div > div part like this:
div > div {
background-color: gray;
border: 1px solid;
float: left;
margin-left: 10px;
}
And then result:
Use % values for all your layout widths.
Use :last-child to set the margin of the right div to zero.
div > div {
background-color: gray;
border: 1px solid;
float: left;
margin-right: 2%
}
div > div:last-child {
margin-right: 0;
}
/* Desktop */
#media (min-width: 992px) {
.col-dsk-3 {
float: left;
width: 32%;
}
}
Here's a codepen:http://codepen.io/prime8/pen/LRympm
Use calc for with
.col-dsk-3 {
float: left;
width: calc(33.33% - 20px);
margin-right: 10px;
}
.col-dsk-3:last-child {
margin-right: 0px;
}
But I suggest you use flexbox instead
When adding the margin-left: 10px to each paragraph you are making their widths larger than 33.33% which results in being greater than 100% pushing the last paragraph down.
Like all things in CSS, there is a couple of different ways you can solve this, but the easiest and most direct answer to your question is using the calc CSS function. The calc function calculates a numerical value in CSS using basic math operations.
Using the calc function you can then set the width of each paragraph to be:
width: calc(33.33% - 10px);
Which will result in a 100% fit.
There are a number of things you can do about this.
1 - Use calc to reduce the width of elements currently set to 33.33% by 10px, and use 10px margin:
.col-dsk-3 {
float: left;
width: calc(33.33% - 10px);
margin-right: 10px;
}
2 - Wrap the content of your columns in another element, and apply a padding to your columns:
<div class="col-dsk-3 col-tbl-2 col-mbl-1">
<div class="column-content">
<p id="chiken">Chicken<p>
<p class="dummy_text">Lorem ipsum dolor sit....</p>
</div>
</div>
.column-content {
background-color: gray;
}
.col-dsk-3 {
float: left;
width: 33.33%;
padding: 10px;
background: none;
}
3 - use flexbox instead of floats for your columns. Remove the floats and the width: 33.33%, and add:
.row {
display: flex;
flex-direction: row;
}
.col-dsk-3 {
margin: 10px;
}
You use percentages to define the width, but add absolute values to the margins. Your widths add up to (almost) 100%, yet you add more margins, resulting in more than 100%, therefore to a value that is bigger than the space that is available.
Adjust your margins to use percentages as well and make sure you end up with 100% or less.
Try this. To use additional div wrapper in HTML.
This way has a good compatibility.
/* Base style */
h1 {
text-align: center;
}
.row {
width: 100%;
height: auto;
padding: 10px;
}
* {
box-sizing: border-box;
font-family: sans-serif;
margin: 0px;
}
/* NOTE: `.row > div > div` is better than `div > div > div` */
div > div > div { /* changed */
background-color: gray;
border: 1px solid;
float: left;
}
.row > div > div { /* changed */
margin: 0 10px;
}
.dummy_text {
clear:right;
padding: 10px;
}
/* Top right paragraphs*/
#chiken {
float: right;
background-color: pink;
border: 2px solid;
width: 150px;
text-align: center;
font-weight: bold;
position: relative;
left: 1px;
padding: 5px;
}
#beef {
float: right;
background-color: indianred;
color: white;
border: 2px solid black;
width: 150px;
text-align: center;
font-weight: bold;
left: 1px;
padding: 5px;
}
#sushi {
float: right;
background-color: lightgoldenrodyellow;
border: 2px solid;
width: 150px;
text-align: center;
font-weight: bold;
left: 1px;
padding: 5px;
}
/* Desktop */
#media (min-width: 992px) {
.col-dsk-3 {
float: left;
width: 33.33%;
}
}
<h1>Our menu</h1>
<div class="row">
<div class="col-dsk-3 col-tbl-2 col-mbl-1">
<div>
<p id="chiken">Chicken<p>
<p class="dummy_text">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>
</div>
<div class="col-dsk-3 col-tbl-2 col-mbl-1">
<div>
<p id="beef">Beef<p>
<p class="dummy_text">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>
</div>
<div class="col-dsk-3 col-tbl-1 col-mbl-1">
<div>
<p id="sushi">Sushi<p>
<p class="dummy_text">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>
</div>
</div>

How do I make my background for a div have an opacity but not the text?

I need help making my background-image have an opacity but not the content thats inside the div? How do I do this and what's wrong with my code? I've tried opacty:numbers and this.
My current code:
#bread_ui {
background: url(../images/bread_ui.png);
margin: 18px auto 15px auto;
width: 1000px;
height: 50px;
border: 3px dotted #999;
border-radius: 10px;
-webkit-mask-image: -webkit-linear-gradient(right, rgba(0,0,0,1), rgba(0,0,0,.3));
}
.ui p {
font-family: Arial;
font-weight: bold;
font-size: 13px;
color: #000;
font-variant: small-caps;
}
.ui a {
text-decoration: underline;
color: #000;
}
My html:
<div id="bread_ui" style="padding-top:25px;">
<div class="ui" style="text-align:right; margin-right:15px"><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>
My result: http://prntscr.com/2z70bh
As you can see, the paragraph has a linear gradient to, how do I make it so it only applies to the background-image?
You can actually just put background in front of the linear gradient
background: -webkit-linear-gradient(right, rgba(0,0,0,1), rgba(0,0,0,.3));
Documentation:
http://www.w3schools.com/css/css3_gradients.asp
Here's the Jfiddle:
http://jsfiddle.net/mCv25/