form figure with css and vue - css

I am trying to create this figure on my site, I am working with CSS and Vue, but so far I am not achieving this goal, I am really new to this
My objective:
What i have so far:
I have not really managed to make it look like the first image, any advice on how I can do it, since I am really new to this
<div id="paralelogramored" class="forma"></div>
<div id="paralelogramowhite" class="forma">
<a Class="">Iniciar Sesion</a>
<img style="float:left;" src="./assets/scss/images/loginLogo.png" class="imgLogin"/>
</div>
my css
.imgLogin{
width: 20px;
}
.forma{
display: inline-block;
margin: 16px;
}
#paralelogramored {
width: 150px;
height: 50px;
background: red;
-webkit-transform: skew(-30deg);
-moz-transform: skew(-20deg);
-o-transform: skew(-20deg);
padding-top: 0px;
}
#paralelogramowhite {
width: 150px;
height: 50px;
background: white;
-webkit-transform: skew(-30deg);
-moz-transform: skew(-20deg);
-o-transform: skew(-20deg);
padding-top: 0px;
}

You could achieve this by using the psuedo element :before. I've attached a quick example of what that could look like.
body {
background: url(https://www.topgear.com/sites/default/files/styles/16x9_1280w/public/images/news-article/2018/07/979c566babe3ae625a9ad7350c019677/a187611_large.jpg?itok=laveSilF) no-repeat;
background-size: cover;
margin: 0;
}
#banner {
width: 380px;
height: 55px;
position: relative;
overflow: visible;
margin: 0 0 0 auto;
background: #fff;
}
#banner:before {
content: '';
display: block;
z-index: 1;
position: absolute;
top: 0;
left: -30px;
background: red;
transform: skew(-45deg);
height: 100%;
width: 30%;
}
#banner .content {
margin-left: 30%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
position: relative;
background: transparent;
}
<div id="banner">
<div class="content">
Content is positioned here
</div>
</div>

Related

Divide a circle on two divs CSS to put add event listener on each part

I need to do this:
Divide a circle on 12 parts
I Try this:
<ul class="circle">
<li class="slide1"><div class="text">1</div></li>
<li class="slide2"><div class="text">2</div></li>
<li class="innerCircle"></li>
</ul>
<style>
.circle {
position: relative;
border: 1px solid black;
padding: 0;
margin: 1em auto;
width: 300px;
height: 300px;
border-radius: 50%;
list-style: none;
overflow: hidden;
}
li {
overflow: hidden;
position: absolute;
top: 0;
right: 0;
width: 50%;
height: 50%;
transform-origin: 0% 100%;
}
.text {
position: absolute;
left: -100%;
width: 200%;
height: 200%;
text-align: center;
-webkit-transform: skewY(60deg) rotate(15deg);
-ms-transform: skewY(60deg) rotate(15deg);
transform: skewY(60deg) rotate(15deg);
padding-top: 20px;
}
.slide1 {
-webkit-transform: rotate(0deg) skewY(-60deg);
-ms-transform: rotate(0deg) skewY(-60deg);
transform: rotate(0deg) skewY(-60deg);
}
.slide2 {
-webkit-transform: rotate(30deg) skewY(-60deg);
-ms-transform: rotate(30deg) skewY(-60deg);
transform: rotate(30deg) skewY(-60deg);
}
.slide1 .text {
cursor: pointer;
background: green;
}
.slide2 .text {
cursor: pointer;
background: orange;
}
</style>
But I need to divide the circle into two parts instead of 12, I don't quite understand the logic of the transformations they use, remove the 10 extra div but it doesn't I can manipulate the size of the remaining ones so that they take up 50% of the circle.
Does anyone know how? I need to divide the circle into two divs to be able to put a JavaScript event on each part
.circle {
position: relative;
border: 1px solid black;
padding: 0;
margin: 1em auto;
width: 300px;
height: 300px;
border-radius: 50%;
list-style: none;
overflow: hidden;
display: grid;
grid-template-columns: 1fr 1fr; /* splitting the circle into 2, equally sized columns/semi-circles */
}
li {
overflow: hidden;
width: 100%;
height: 100%;
position: relative;
}
.text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 5rem
}
.slide1 {
cursor: pointer;
background: green;
}
.slide2 {
cursor: pointer;
background: orange;
}
<ul class="circle">
<li class="slide1">
<div class="text">1</div>
</li>
<li class="slide2">
<div class="text">2</div>
</li>
</ul>

CSS rotation create unwanted border around divs

I was trying to do the pie chart based on three divs. However, there's always some unwanted border around the divs. Also, they'll expand or shrink while zooming in and out.
Try many ways on other similar questions' solutions. Still can't work.
codepen link https://codepen.io/DavidLee0314/pen/PXWzYJ?editors=1100
* {
width: 100%;
height: 100%;
position: absolute;
margin: 0px;
padding: 0px;
}
.pie {
left: 40%;
top: 30%;
width: 174px;
height: 174px;
border-radius: 100%;
overflow: hidden;
display: flex;
justify-content: center;
font-size: 0px;
white-space: nowrap;
}
.pie .small-box {
width: 100%;
height: 100%;
}
.pie .grey {
transform: translateX(-50%);
background-color: #f3f5f2;
}
.pie .green {
transform: translateX(25%);
background-color: #222;
}
.pie .change {
transform-origin: left center 0;
transform: translateZ(0) scale(1, 1) translateX(50%) rotate(0deg);
background-color: #f3f5f2;
}
<div class="pie">
<div class="small-box green"></div>
<div class="small-box grey"></div>
<div class="small-box change"></div>
</div>
just use this at *:
Border: none:
* {
width: 100%;
height: 100%;
position: absolute;
margin: 0;
padding: 0;
border: none;
}
.pie{
left: 40%;
top: 30%;
width: 174px;
height: 174px;
border-radius: 100%;
overflow: hidden;
display: flex;
justify-content: center;
font-size: 0;
white-space: nowrap;
}
.small-box {
width: 100%;
height: 100%;
}
.grey {
transform: translateX(-50%);
background-color: #f3f5f2;
}
.green {
transform: translateX(25%);
}
.change {
transform-origin: left center 0;
transform: translateZ(0) scale(1.0, 1.0) translateX(50%) rotate(0deg);
background-color: #f3f5f2;
}
<div class="pie">
<div class="small-box green"></div>
<div class="small-box grey"></div>
<div class="small-box change"></div>
</div>

Styling a background in CSS3 with opacity?

I have a simple css styling question. I've been trying to create this effect on a background to match a design but i just can't seem to get it right.
Here is what I have
And here is the design
does anyone have any tips to help me create that background effect? any help would be appreciated.
My code right now, if it helps:
.backgroundOverlay {
background-image: url('../images/background-pattern.png'), linear-
gradient(to bottom right, rgba(0,118,255,0.8), rgba(0,197,255,0.8));
/* opacity: 0.3; */
height: 100vh;
width: 100vw;
top: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
/* padding: 15vw 5vw; */
}
The background image is just a repeated .png file
Thank you in advance
Use this:
.container{
width: 100%;
height: 300px;
border: 1px solid #000;
position: relative;
}
.container .content{
position: absolute;
z-index:999;
text-align: center;
width: 100%;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
.container::after{
content: "";
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index:99;
background-image: url("path/to/yourfile.png");
background-size: repeat;
opacity: 0.4;
}
<div class="container">
<div class="content">
<img src="path/to/your/upper_frame.png" />
</div>
</div>

How to overlay divs with pure css?

To create this effect:
It is possible or would I need to design it with software?
You could use gradient as background
div {
background: -moz-linear-gradient(-45deg, #1e5799 50%, #207cca 50%, #7db9e8 100%);
background: -webkit-gradient(linear, left top, right bottom, color-stop(50%,#1e5799), color-stop(50%,#207cca), color-stop(100%,#7db9e8));
...
}
An example : http://jsfiddle.net/w9fYj/
You can do it with triangles (which basically works on border adjustments) How do CSS triangles work?
And other shapes for more
Here is extensive example with transforms of many divisions which may interest you.
Demo
HTML
<div class="wrapper">
<div class="shape3">
<div class="shape3-content">Hi there!</div>
</div>
<div class="shape1">
<div class="shape1-content">Hi there!</div>
</div>
<div class="shape2">
<div class="shape2-content">Hi there!</div>
</div>
</div>
css
.wrapper {
border: 1px solid #ff8888;
height: 480px;
left: 50%;
margin: -240px 0 0 -320px;
overflow: hidden;
position: absolute;
top: 50%;
width: 640px;
}
.shape1 {
-webkit-transform: rotate(15deg);
-moz-transform: rotate(15deg);
background-color: #fff;
border: 1px solid black;
height: 50%;
left: -25%;
position: absolute;
top: 70%;
width: 150%;
}
.shape1-content {
-webkit-transform: rotate(-15deg);
-moz-transform: rotate(-15deg);
padding-left: 230px;
}
.shape2 {
-webkit-transform: rotate(15deg);
-moz-transform: rotate(15deg);
background-color: #fff;
border: 1px solid #88ff88;
bottom: 244px;
height: 100%;
position: absolute;
right: 50%;
width: 100%;
}
.shape2-content {
-webkit-transform: rotate(-15deg);
-moz-transform: rotate(-15deg);
bottom: 10px;
position: absolute;
right: 10px;
}
.shape3 {
background:red;
-webkit-transform: rotate(30deg);
-moz-transform: rotate(30deg);
border: 1px solid #8888ff;
bottom: 40%;
height: 100%;
position: absolute;
right: 20%;
width: 100%;
}
.shape3-content {
-webkit-transform: rotate(-30deg);
-moz-transform: rotate(-30deg);
bottom: 50%;
position: absolute;
right: 10px;
}
Here it is using pure CSS:
HTML
<div id="test">
</div>
CSS
#test {
widh:300px;
height:150px;
background:#C3C3C3;
position:relative;
overflow:hidden;
}
#test:after {
content:'';
position:absolute;
right:-100px;
top:10px;
transform:rotate(-30deg);
-webkit-transform:rotate(-30deg);
-moz-transform:rotate(-30deg);
-o-transform:rotate(-30deg);
-ms-transform:rotate(-30deg);
width:500px;
height:250px;
background:#880015;
}
And here is a FIDDLE
If you consider to support old browsers without using CSS3 then:
HTML
<div class="wrapper">
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
</div>
CSS
.wrapper {
width: 400px;
height: 100px;
}
.left {
display: inline;
float: left;
background-color: #ccc;
width: 100px;
height: 100px;
}
.right {
display: inline;
float: right;
background-color: #610A0A;
width: 200px;
height: 100px;
}
.middle {
float:left;
display: inline;
line-height: 0%;
width: 0px;
border-top: 100px solid #ccc;
border-right: 100px solid #610A0A;
}
Fiddle Demo

How do i vertically center align div with dynamic multiple line text

Below is the CSS i am using:
.flip-container
{
-webkit-perspective: 1000;
-moz-perspective: 1000;
perspective: 1000;
}
.flip-container:hover .flipper, .flip-container.hover .flipper {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.flip-container, .front, .back {
width: 150px;
height: 150px;
}
.flipper {
-webkit-transition: 0.6s;
-webkit-transform-style: preserve-3d;
-moz-transition: 0.6s;
-moz-transform-style: preserve-3d;
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.front, .back {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
display: table-cell;
vertical-align:middle;
position: absolute;
top: 0;
left: 0;
}
.front {
z-index: 2;
text-align: center;
}
.back {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.front .name {
font-size: 2em;
display: inline-block;
background: rgba(33, 33, 33, 0.9);
color: #f8f8f8;
font-family: Courier;
padding: 5px 10px;
border-radius: 5px;
bottom: 60px;
left: 25%;
position: absolute;
text-shadow: 0.1em 0.1em 0.05em #333;
-webkit-transform: rotate(-20deg);
-moz-transform: rotate(-20deg);
transform: rotate(-20deg);
}
.back-logo {
position: absolute;
top: 40px;
left: 90px;
width: 160px;
height: 117px;
background: url(logo.png) 0 0 no-repeat;
}
.back-title {
font-weight: bold;
color: #00304a;
position: absolute;
top: 180px;
left: 0;
right: 0;
text-align: center;
text-shadow: 0.1em 0.1em 0.05em #acd7e5;
font-family: Courier;
font-size: 2em;
}
.back p {
position: absolute;
bottom: 40px;
left: 0;
right: 0;
text-align: center;
padding: 0 20px;
}
The HTML that i am using looks like this :
<div id="article"><div class="flip-container" ontouchstart="this.classList.toggle('.'hover'.');">
<div class="flipper">
<div class="front">
<!-- front content -->
</div>
<div class="back">
<!-- back content -->
<img src="" width="160" height="160" /> </div>
</div>
</div>
</div>
The CSS of the article class is:
#article {
margin: 5px;
float: left;
height: 150px;
width: 150px;}
I am unable to make the fext in the FRONT div center vertically centered. Also it would be dynamic and multiline. Any Ideas?
I tried using 'vertical-align:middle' along with 'display:table-cell' but that didn't help or maybe i just applied them to the wrong CSS Blocks.
The Code is on jsFiddle: here
You can use display: table for your parent container and display: table-cell for your child container:
#article {
display:table;
height: 150px;
width: 150px;
float: left;
text-align: center;
}
.front {
display: table-cell;
vertical-align:middle;
}
Fiddle Demo: http://jsfiddle.net/uVSN6/1/

Resources