logo
Tags down

shadow

How to make CSS clip path only reside on top of div?


By : dwerbam
Date : October 16 2020, 08:10 PM
it fixes the issue I just wanna ask how we create a clip path that reside only on top of div's. For example, I've a rectangular div like this: , If you can't find another solution, it might work.
code :
body {
  margin: 0 auto;
  background:tomato;
}

.container {
  width: 320px;
  height: 600px;
  position:relative;
}

.rectangle {
  background-image: linear-gradient(-197deg, #E1DFFA 0%, #E1E0FA 34%, #EDFCFE 86%, #EDFCFE 86%);
  width: 320px;
  height: 600px;
  clip-path: url(#path);
  position:absolute;
  top:0;
  left:0;
  z-index:2;
}

.linear {
  background-image: linear-gradient(-197deg, #E1DFFA 0%, #E1E0FA 34%, #EDFCFE 86%, #EDFCFE 86%);
  width: 320px;
  height: 488px;
  position:absolute;
  left:0;
  z-index:-2;
  bottom:0;
}
<svg width="321px" height="112px" viewBox="0 0 321 112" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<clipPath id="path">
    <path d="M0,54.6239019 C32.8368888,93.6621872 61.3541089,112.45422 85.5516602,111 C151.463201,111.161716 173.963962,18.2383058 321,0 C321.133852,37.3108666 321.133852,74.6442 321,112 L0,112 L0,54.6239019 Z" id="Rectangle" fill="#000000"></path>
    </clipPath>
</svg>
<div class="container">
<div class="rectangle">
</div>
<div class="linear">
</div>
</div>


Share : facebook icon twitter icon

How to make a CSS3 Clip Path


By : skol
Date : March 29 2020, 07:55 AM
seems to work fine clip-path is still a very experimental CSS3 element and therefore isn't very well supported and what support there is is minimal.
Using the CSS3 clip-path element to generate the polygon only allows for straight corners as its all point based rather than allowing for curves.
code :
body {
  background: #555;
  margin: 0;
}
img {
  -webkit-clip-path: polygon(98% 0, 100% 2%, 100% 88%, 98% 90%, 25% 90%, 20% 99%, 15% 90%, 2% 90%, 0 88%, 0 2%, 2% 0);
  clip-path: polygon(98% 0, 100% 2%, 100% 88%, 98% 90%, 25% 90%, 20% 99%, 15% 90%, 3% 90%, 0 88%, 0 2%, 2% 0);
}
<img src="http://lorempixel.com/200/200/" />
body {
  background: #555;
  margin: 0;
}
img {
  clip-path: url(#svgPath);
  -webkit-clip-path: url(#svgPath);
}
<svg height="0" width="0">
  <defs>
    <clipPath id="svgPath">
      <path fill="#FFFFFF" d="M50,0 L450,0 Q500,0 500,50 L500,400 Q500,450 450,450 L200,450 L175,500 L150,450 L50,450 Q0,450 0,400 L0,50 Q0,0 50,0z" />
    </clipPath>
  </defs>
</svg>

<img src="http://lorempixel.com/500/500/" />

Why does clip-path inset(0 0 0 0) produce a different result than not setting clip path?


By : Alex
Date : March 29 2020, 07:55 AM
seems to work fine I can't tell you why, but it looks like a webkit bug with -webkit-clip-path and as far as I can see only happens in Chrome (I've tested it on Firefox, IE, Opera, and Chrome).
Try replacing the webkit -webkit-clip-path: inset(0% 0% 0% 0%); with -webkit-clip-path: rect(0% 0% 0% 0%);

Transform CSS clip-path with mixed (fixed and percentage) values to SVG clip-path


By : chandrakanth527
Date : March 29 2020, 07:55 AM
seems to work fine With the help from Stack Overflow in Russian using SVG mask my solution is this
code :
.container {
  width: 200px;
  height: 200px;
}

svg {
  width: 100%;
  height: 100%;
}
<div class="container">
  <svg>
    <defs>
      <mask id="triangle-clip">
        <rect x="0" y="0" width="100%" height="100%" fill="#fff" />
        <path d="M0,20 v-20 h20 z" fill="#000" />
      </mask>

    <linearGradient id="grad1" x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" style="stop-color:rgb(0,0,255);stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1" />
    </linearGradient>
  </defs>
  <rect width="100%" height="100%" fill="url(#grad1)" mask="url(#triangle-clip)" />
</svg>
</div>

how to make content overly a clip-path shape div?


By : Alexander910
Date : March 29 2020, 07:55 AM
I wish this helpful for you What you want is impossible because clip-path will clip the element and all its content.
You can try to build the shape differently using skew transformation like below:
code :
.header {
  height: 200px;
  position:relative;
  overflow:hidden;
  z-index:0;
}
.header:before {
  content:"";
  position:absolute;
  z-index:-1;
  top:0;
  left:0;
  right:0;
  bottom:0;
  transform-origin:left;
  transform:skewY(-5deg);
  background-image: linear-gradient(215deg, #3f2b96, #a8c0ff);;
}
img {
 display:block;
 margin: 10px 10px 0 auto;
}

body {
 margin:0;
}
<div class="header">
 <img src="https://picsum.photos/id/1000/200/200">
</div>

How to make a border around clip path shape?


By : user3193663
Date : March 29 2020, 07:55 AM
Any of those help I am trying to create hexagon shaped buttons that have a transparent background and white 1px solid border around the hexagon I created with clip path. However, when I apply a border part of it is cut off. How can I achieve this look? , This is what i Got so far,
I've used filter: drop-shadow()
code :
.hexagon{
  background: white;/*giving color is important*/
  padding: 40px;
  width: 20%;
  text-align: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
/* main code */
.container{
  filter: drop-shadow(0px 0px 1px black);
}
  <div class="container">
    <div class="hexagon">Button</div> 
  </div>
Related Posts Related Posts :
  • 16bit canvas with WebGL 1
  • "Elements should not have tabindex greater than zero" - Nonzero Tabindex Breaks Validation & 508 Complianc
  • Dynamic form using *ngFor and submitting values from it
  • Why does Firefox not use CSS from an local absolute path?
  • Bootstrap 4 Card Component Remove unnecessary whitespace
  • Link takes double click to activate- how to make it only one? Angular 5
  • How to center a DIV in the remaining space on RHS of another DIV
  • Yii2 Remove container div specific to every record from listview
  • Charm bar doesn't scroll to bottom
  • Sticky footer is hiding content at the bottom of my website
  • Why I am getting GET vars in a POST form?
  • How do I make the "after" pseudo-element always be on the same line in my table headers?
  • Bootstrap 4 Order div columns
  • Auto-width image with `srcset` attribute
  • How to make the image also have rounded corners?
  • Scrape table for nested table in local html using selenium
  • Fixed side chat menu using flex box
  • Select all siblings if one of them has a specific class
  • HLS / Media Source Extensions <video> with muted & autoplay freezes on first frame on mobiles
  • HTML element doesnt contain all page contents
  • XPath to find elements
  • Target only the first direct child not working despite :nth-child(1)
  • Why nuxt insert all css link into every page with extractCss true
  • User agent stylesheet is overriding my css even though it acknowledges it shouldn't?
  • Basic tags in html clarification
  • CSS Lifted Corners in Foundation 6
  • Allow page breaks inside tr and td elements
  • Creating a dropdown menu purely with HTML + CSS
  • How to add vertical space between inputs in a form?
  • Submit button does not pass form data
  • Why a row is stacked in column
  • Button style differs on different screens and devices
  • Text on Left, Icon on Right - Bootstrap
  • Grid is not flexible enough to sort the posts
  • CSS — How to blur a SVG mask?
  • Disable the growing ability of an element
  • Line up text over multiple lines under each other?
  • CSS3 Grid fill space in last row
  • Convert six column flex layout into three columns
  • ngModel with select list
  • Spring boot Requested mapping value variable
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org