Two backgrounds horizontal in div one rounded div - html

I have small problem with make a two horizontal backgrounds in one div with border radius. I want the main div was a circle.
My code
body{
text-align: center;
}
.split-outer {
position: relative;
display: inline-block;
width: 200px;
height: 200px;
z-index: 2;
background: #014495;
border-radius: 100%;
}
.split-outer::after{
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 50%;
z-index: -1;
background: #fff;
border-bottom-right-radius: 200px;
border-bottom-left-radius: 200px;
}
.split-inner{
width: 200px;
height: 200px;
margin: 0 auto;
color: #fff;
text-align: center;
}
span{
display: block;
}
span.split-title{
padding: 30px 0 10px 0;
font-size: 55px;
text-align: center;
line-height: 55px;
}
span.split-content{
padding: 20px 0;
font-size:18px;
color: #014495;
}
<div class="container-fliud">
<div class="jumbotron">
<div class="split-outer">
<div class="split-inner">
<span class="split-title">100</span>
<span class="split-content">Lorem ipsum</span>
<button type="button" class="btn btn-primary btn-sm">Button</button>
</div>
</div>
</div>
</div>
But i have a small bug, in the after element i see some blue backround line from the first div. It looks like a border line genrated from the radius. But i wannt a clean white round background.
Codepen prev :http://codepen.io/michal_t/pen/KdoZYz/

Put border: 2px solid white in :after.
Here is css code:
body {
text-align: center;
}
.split-outer {
position: relative;
display: inline-block;
width: 200px;
height: 200px;
z-index: 2;
background: #014495;
border-radius: 100%;
}
.split-outer::after {
content: "";
position: absolute;
left: -2px;
bottom: -1px;
width: 100%;
height: 50%;
z-index: -1;
background: #fff;
border-bottom-right-radius: 200px;
border-bottom-left-radius: 200px;
border: 2px solid white;
}
.split-inner {
width: 200px;
height: 200px;
margin: 0 auto;
color: #fff;
text-align: center;
}
span {
display: block;
}
span.split-title {
padding: 30px 0 10px 0;
font-size: 55px;
text-align: center;
line-height: 55px;
}
span.split-content {
padding: 20px 0;
font-size: 18px;
color: #014495;
}
Here is fiddle.

You could create the top half of the background by removing the background color from .split-outer and then using a :before pseudo, similar to how the bottom half is created with an :after pseudo.
.split-outer:before {
content: "";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 50%;
z-index: -1;
background: #014495;
background-image: initial;
background-position-x: initial;
background-position-y: initial;
background-size: initial;
background-repeat-x: initial;
background-repeat-y: initial;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: #014495;
border-top-right-radius: 200px;
border-top-left-radius: 200px;
}
http://codepen.io/anon/pen/dYmdva

Related

when hovering over a div the button does not change transparency [duplicate]

This question already has answers here:
How to affect other elements when one element is hovered
(9 answers)
Closed 8 months ago.
I need to make when hovering over a div with an image, there is black background with opacity and when hovering over the button, it changes its values. I got the following:
.promo__girl {
background-repeat: no-repeat;
background-image: url('https://i.ibb.co/r0rnSP0/1.png');
position: absolute;
width: 300px;
height: 300px;
margin-top: 136px;
right: 7.469rem;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
}
.promo__girl-image {
width: 100%;
}
.promo__girl-hover {
width: 300px;
height: 300px;
border-radius: 10px;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
}
.promo__girl .button_yellow {
font-size: 16px;
color: #162E3C;
background-color: #DDF0A7;
border: 2px solid #DDF0A7;
text-align: center;
margin-top: 10px;
border-radius: 64px;
margin-right: 4px;
height: 52px;
width: 233px;
z-index: 1;
}
.promo__girl .button_yellow:hover {
width: 233px;
background-color: inherit;
color: white;
border-color: white;
opacity: 1;
}
.promo__girl-hover:hover {
background-color: black;
opacity: 0.7;
transition: 0.5s;
}
<div class="promo__girl">
<div class="promo__girl-hover"><button class="button_yellow">Watch Introduction</button></div>
</div>
So now when i hovering image, opacity applies to button to, but i donr need it. Maybe someone will help me? Maybe you can do this with display:none or visibility: hidden/visible? I tried it but there is 0 result.
You can't override parent opacity in a child. But you can use "another" element to be darker... the :after pseudo element. It works.
.promo__girl {
background-repeat: no-repeat;
background-image: url('https://i.ibb.co/r0rnSP0/1.png');
position: absolute;
width: 300px;
height: 300px;
margin-top: 136px;
right: 7.469rem;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
}
.promo__girl-image {
width: 100%;
}
.promo__girl-hover {
width: 300px;
height: 300px;
border-radius: 10px;
position: absolute;
display: flex;
justify-content: center;
align-items: center;
}
.promo__girl .button_yellow {
font-size: 16px;
color: #162E3C;
background-color: #DDF0A7;
border: 2px solid #DDF0A7;
text-align: center;
margin-top: 10px;
border-radius: 64px;
margin-right: 4px;
height: 52px;
width: 233px;
z-index: 1;
}
.promo__girl .button_yellow:hover {
width: 233px;
background-color: inherit;
color: white;
border-color: white;
opacity: 1;
}
.promo__girl-hover:after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: black;
opacity: 0;
transition: 0.5s;
pointer-events: none;
}
.promo__girl-hover:hover:after {
opacity: 0.7;
transition: 0.5s;
}
<div class="promo__girl">
<div class="promo__girl-hover">
<button class="button_yellow">Watch Introduction</button>
</div>
</div>

How can I remove the gap when I used ::after in a div? [duplicate]

This question already has answers here:
How do CSS triangles work?
(23 answers)
Closed 1 year ago.
I wanted to experiment with ::after, so I made three figures (square, circle and triangle) then put their respective after, and works fine with the circle and square however with the triangle makes a gap and I don't understand why, I tried changing the positions and displays attributes but it didn't work
.maincontainer {
background-color: whitesmoke;
border-radius: 1rem;
width: 95%;
min-height: 200px;
margin: 0 auto;
display: flex;
}
.maincontainer div {
margin: 10px;
background-color: teal;
}
.cuadrado {
width: 100px;
height: 100px;
}
.circulo {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: yellowgreen !important;
}
.triangulo {
width: 0px;
border-bottom: 100px solid yellow;
border-left: 50px solid transparent;
background-color: transparent !important;
border-right: 50px solid transparent;
}
.triangulo::after {
content: "Triangulo";
position: fixed;
top: 120px;
left: 28.5%;
}
.cuadrado::after {
content: "Cuadrado";
position: fixed;
top: 120px;
left: 65px;
}
.circulo::after {
content: "circulo";
position: fixed;
top: 120px;
left: 195px;
}
<div class="maincontainer">
<div class="cuadrado"></div>
<div class="circulo"></div>
<div class="triangulo"></div>
</div>
You can remove the gap by setting the height to 0px
note: I also set left: 48% just to make the triangulo word in the center
.maincontainer {
background-color: whitesmoke;
border-radius: 1rem;
width: 95%;
min-height: 200px;
margin: 0 auto;
display: flex;
}
.maincontainer div {
margin: 10px;
background-color: teal;
}
.cuadrado {
width: 100px;
height: 100px;
}
.circulo {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: yellowgreen !important;
}
.triangulo {
width: 0px;
height: 0px; /* << here */
border-bottom: 100px solid yellow;
border-left: 50px solid transparent;
background-color: transparent !important;
border-right: 50px solid transparent;
}
.triangulo::after {
content: "Triangulo";
position: fixed;
top: 120px;
left: 48%;
}
.cuadrado::after {
content: "Cuadrado";
position: fixed;
top: 120px;
left: 65px;
}
.circulo::after {
content: "circulo";
position: fixed;
top: 120px;
left: 195px;
}
<div class="maincontainer">
<div class="cuadrado"></div>
<div class="circulo"></div>
<div class="triangulo"></div>
</div>

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>

How to create the corner that show in picture with css in webpage?

How to create the curve that you see in picture with CSS and HTML?
Can I use CSS border radius or use other solution?
You could do it with two divs and psuedo elements :before and :after. Working code below
.top-bar{
height: 100px;
width: 100%;
background-color: #55c3ff;
}
.curved-bottom{
width: 80%;
margin: 0 auto;
height: 50px;
background-color: #55c3ff;
border-radius: 0 0 20px 20px;
position: relative;
}
.curved-bottom:before {
height: 50px;
width: 16%;
background-color: white;
border-top-right-radius: 10px;
left: -16%;
content: '';
position: absolute;
top: -8px;
}
.curved-bottom:after {
height: 50px;
width: 16%;
background-color: white;
border-top-left-radius: 10px;
right: -16%;
content: '';
position: absolute;
top: -8px;
}
<div class="top-bar"></div>
<div class="curved-bottom"></div>
If your main horizontal blue bar is a div, and the box sticking down is a separate div, you can use the pseudo elements :before and :after to create those inner radius.
See the following as an example:
html,
body {
padding: 0;
margin: 0;
}
.header {
position: relative;
background-color: #5DC4FD;
width: 100%;
height: 160px;
}
.tab {
position: relative;
top: 130px;
background-color: #5DC4FD;
width: 80%;
height: 100px;
margin: 0 auto;
border-radius: 0 0 30px 30px;
}
.tab:before {
position: absolute;
content: "";
left: -50%;
width: 50%;
height: 100px;
background-color: white;
border-radius: 0 30px 0 0;
}
.tab:after {
position: absolute;
content: "";
right: -50%;
width: 50%;
height: 100px;
background-color: white;
border-radius: 30px 0 0 0;
}
<div class="header">
<div class="tab">
</div>
</div>
Well, you could use overlapping divs like this:
#top {
background: #00BFFF;
width: 100%;
height: 150px;
}
#container{
display: flex;
}
#mid{
background: #00BFFF;
width: 70%;
height: 50px;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
#left{
background: #FFFFFF;
margin-top: -50px;
width: 15%;
height: 50px;
border-top-right-radius: 25px;
}
#right{
background: #FFFFFF;
margin-top: -50px;
width: 15%;
height: 50px;
border-top-left-radius: 25px;
}
<div id="top"></div>
<div id="container">
<div id="left"></div>
<div id="mid"></div>
<div id="right"></div>
</div>
but I'd recommend using a background image with the desired shape

Don't work border when you hover DIV

I need when you hover a mouse on one div other div with parametres appear from below and these both divs have common border.
Now I have border only on first div. It looks like first div don't contain second, but in html code div with parametres is beetwen of first.
What is wrong?
.item {
width: 220px;
height: 300px;
margin: 10px 3px;
float: left;
position: relative;
}
.item:hover .item_inner {
position: absolute;
top: 0;
left: 0;
z-index: 10;
background: #fff;
box-shadow: 0 1px 14px rgba(0,0,0,0.3);
height: 100%;
}
.item_param {
display: none;
text-align: left;
padding: 0 5px;
margin: 10px 0;
background-color: #f3f3f3;
}
.item_inner{
width: 100%;
height: 100%;
position: relative;
padding-bottom: 5px;
border: 1px solid green;
}
.item_inner:hover .item_param {
display: block;
top: 100%;
width: 100%;
position: absolute;
}
<div class="item">
<div class="item_inner">
TEXT
<div class="item_param">
<p>Parametres</p>
<p>Parametres</p>
<p>Parametres</p>
</div>
</div>
</div>
.item_inner:hover .item_param {
display: block;
top: 100%;
width: 100%;
position: relative;
}