How to create shape in HTML using CSS with browser compatibility - html

I want to create a shape in HTML using CSS like this
How can I create this shape in HTML using CSS. Any best solution.
Thanks

You can use CSS clip-path:
.yourclass {
width: 200px;
height: 200px;
background-color: orange;
-webkit-clip-path: polygon(20% 0%, 60% 0, 0 60%, 0 20%);
clip-path: polygon(20% 0%, 60% 0, 0 60%, 0 20%);
}
<div class="yourclass"></div>
Play around with it on Clippy.

Related

How do I change the Sign in with email form colors in Firebase UI Web Loaded from CDN

Is there a way to override the CSS without rebuilding the entire FirebaseUI?
I need to change the purple colors in the form below.
I am not using mobile. I just have the script tag bringing the CSS and JavaScript in for FirebaseUI from the CDN.
Want to override the colors using a style tag in the html of the page.
Don't want to fork, change deploy and now have to maintain more code.
:)
I have this link to the css but can't figure out which property is controlling the color.
https://github.com/firebase/firebaseui-web/blob/master/stylesheet/firebase-ui.css
Here is the github project for reference:
https://github.com/firebase/firebaseui-web
I had to do this a few weeks ago. Here are the properties I changed:
.firebaseui-button {
background-color: #ff626e !important;
color: white !important;
}
.firebaseui-textfield.mdl-textfield .firebaseui-label:after {
background-color: #ff626e !important;
}
.mdl-progress > .progressbar {
background-color: #ff626e !important;
}
.mdl-progress > .bufferbar {
background-image: linear-gradient(
90deg,
hsla(0, 0%, 100%, 0.7),
hsla(0, 0%, 100%, 0.7)
),
linear-gradient(90deg, #ff626e, #ff626e) !important;
z-index: 0;
left: 0;
}
.mdl-progress:not(.mdl-progress--indeterminate) > .auxbar,
.mdl-progress:not(.mdl-progress__indeterminate) > .auxbar {
background-image: linear-gradient(
90deg,
hsla(0, 0%, 100%, 0.9),
hsla(0, 0%, 100%, 0.9)
),
linear-gradient(90deg, #ff626e, #ff626e) !important;
}

I am trying to style the thumb of a range input but the webkit doesn't work

Well I am trying to style a range thumb in chrome but the my code just doesn't work in any way and I don't know why:
html
<input type="range" min="0" max="38" value="20" class="slider" id="slider">
sass:
&::-webkit-slider-thumb
background-color: #000000
clip-path: polygon(0 46%, 100% 45%, 100% 60%, 0 61%)
height: 100%
width: 50%
padding: 0
opacity: 0.8
&:hover
opacity: 1
This is the jfidle whit all the code https://jsfiddle.net/81x7v4tn/
open in in chrome to see the problem
The issue was that you haven't eliminated the default appearance of the slider thumb. So no custom style would be implemented if the default appearance is set.
Change done to SASS:
&::-webkit-slider-thumb
-webkit-appearance: none
appearance: none
background-color: #000000
//clip-path: polygon(0 46%, 100% 45%, 100% 60%, 0 61%)
height: 100%
width: 50%
padding: 0
cursor: pointer
opacity: 1
Working fiddle:- https://jsfiddle.net/5pe42ron/
I hope that works for you.
Thanks

CSS Parallelogram-Cut Border Pattern

I would like insight as to whether or not it is possible to develop a border pattern like the one displayed here through CSS code. I've considered making the pattern through a Photoshop-like program and then setting the background of the border to the url of the photoshop-made pattern. How I run into browser compatibility issues if I wish to pursue this through coding?
Able to make a pretty similar border using straight css.
First, in before, generated a box with 3 striped lines- one red, one blue, one beige. Also added the beige border to this.
Then, in the :after pseudo element, just gave the box a beige background (probably could look better with a gradient background too).
Check it out:
<!DOCTYPE html>
<html>
<head>
<style>
p.box:before{
content: '';
position: absolute;
z-index: -1;
width: 100%;
height: 100%;
background:repeating-linear-gradient(
45deg,
hsl(60, 56%, 81%) 0px,
hsl(60, 56%, 81%) 4px,
red 5px,
red 14px,
hsl(60, 56%, 81%) 15px,
hsl(60, 56%, 81%) 20px,
hsla(247, 83%, 37%, 1) 21px,
hsla(247, 83%, 37%, 1) 30px
),
linear-gradient(
to bottom,
rgba(48, 26, 255, 1),
rgba(85, 66, 255, 1)
);
border: 5px solid hsl(60, 56%, 81%);
}
p.box:after{
content: '';
position: absolute;
right: -.5%;
bottom: -2.5%;
background: hsl(60, 56%, 81%);
z-index: -1;
height: 97%;
width: 97%;
}
</style>
</head>
<body>
<p class="box"></p>
</body>
</html>

Creating A Cube Using Only CSS Gradients

I've tried numerous ways using linear-gradients to create several stripes layered on top of each other and have gotten very close but seem to be stuck on the top face. I'm trying to accomplish this using gradients be it linear or radial so that I can eventually upgrade them to repeating gradients and have a nice background of cubes. I'm applying css to an empty body tag. I think it might actually be impossible, somebody please prove me wrong! This is the perspective i was going for:
/ \
|\ /|
| | |
\ /
I used the before and after pseudo-element to get the 3D cube effect. Here is the code:
<!doctype html>
<html>
<head>
<style>
div {
width:100px;
height:100px;
-webkit-transform: rotateX(45deg) rotateY(0deg) rotateZ(45deg);
margin: 20px;
background: red;
}
div::before {
display: block;
content: '';
position: absolute;
width: 71px;
height: 102px;
background: green;
-webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(-45deg) translateX(-24px) translateY(96px) skewY(45deg);
}
div::after {
display: block;
content: '';
position: absolute;
width: 72px;
height: 100px;
background: blue;
-webkit-transform: rotateX(0) rotateY(0deg) rotateZ(0deg) translateX(100px) translateY(36px) skewY(45deg);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Welp, i fingered it out myself!
#cube
{
width:500px;
height:150px;
background:
linear-gradient(45deg,
black 0%,
black 43%,
transparent 43%,
transparent 60%,
black 60%,
black 100%
),
linear-gradient(-45deg,
black 0%,
black 43%,
transparent 43%,
transparent 60%,
black 60%,
black 100%
),
linear-gradient(90deg,
black 0%,
black 44%,
transparent 44%,
transparent 56.5%,
black 56.5%,
black 100%
),
linear-gradient(45deg,
transparent 0%,
transparent 50%,
rgba(150, 0, 0, 0.388235) 50%,
rgba(150, 0, 0, 0.388235) 100%
),
linear-gradient(-45deg,
transparent 0%,
transparent 50%,
rgb(255, 0, 0) 50%,
rgb(255, 0, 0) 100%
),
linear-gradient(90deg,
rgb(255, 0, 0) 0%,
rgb(255, 0, 0) 50%,
rgb(150, 0, 0) 50%,
rgb(150, 0, 0) 100%
),
black;
}
<!DOCTYPE html>
<html>
<body>
<div id="cube"></div>
</body>
</html>
Hi for creating a cube using css you must have to define the perspective width for box, and then rotate it to a certain angle to get its look.
here you may find how create a css cube
CSS 3D Cube
and here you may learn how Perspective property works
Perspective,
Hope it will help.

CSS Fade Out HR Line issue

So I am trying to setup the fadeout css3 hr tag, it works on JSFiddle but I can't solve it on my site.
My CSS class on site:
.about-sidebar{
margin: 25px 0;
height: 1px;
background: black;
background: -webkit-gradient(linear, 0 0, 100% 0, from(#1F1F1F), to(#FFD700), color-stop(50%, black));
}
HTML:
<hr class="about-sidebar" />
I have tried taking the class out of the HR tag and surrounding it with a div but doesn't solve.
Site: http://travisingram.net/ it is the "Welcome to my Blog" on the sidebar.
Jsfiddle working:
http://jsfiddle.net/ZTz7Q/1633/
The reason it wasn't working on your website was because the <hr> didn't contain the class with the gradient styling. Currently, you just have <hr> which should be changed to <hr class="line"> or whatever class you're using.
Aside from that, the linear-gradients needs some tweaking and cross browser prefix vendors for more support.
jsFiddle example
I don't know what colors you want.. but here is black to transparent.
.line {
margin: 25px 0;
height: 5px;
background: black;
background: -moz-linear-gradient(left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.98) 2%, rgba(255,255,255,0) 90%);
background: -webkit-linear-gradient(left, rgba(0,0,0,1) 0%,rgba(0,0,0,0.98) 2%,rgba(255,255,255,0) 90%);
background: linear-gradient(to right, rgba(0,0,0,1) 0%,rgba(0,0,0,0.98) 2%,rgba(255,255,255,0) 90%);
}