clip-path

Responsive clip-path with inline SVG

萝らか妹 提交于 2019-12-17 19:49:19
问题 On an element with a background (image or solid color don't really matter): <header id="block-header"></header> I am trying to apply a clip-path using SVG. To achieve this, I am putting SVG inline into the same element like this: <header id="block-header"> … <svg width="100%" height="100%" viewBox="0 0 4000 1696" preserveAspectRatio="none"> <defs> <clipPath id="myClip"> <path d="M0 1568.18V0h4000v1568.18S3206.25 1696 2000 1696C984.37 1696 0 1568.18 0 1568.18z"/> </clipPath> </defs> </svg> … <

web前端入门到实战:CSS没有边界的裁剪路径 - Clip Paths

折月煮酒 提交于 2019-12-17 03:55:01
在深入研究之前,我们应该先看看基本的形状和clip-path。裁剪路径可以将CSS Shapes如circle()、ellipse(), inset()或自由变化的polygon()应用于任何元素。元素中不在形状边界内的任何内容都将被裁剪删除掉。 使用多边形函数,我们可以创建三角形、星形或其他形状,虽然在可以使用px等固定单位,但百分比将提供更大的灵活性并自适应于元素的尺寸。 所以对于一个八边形,我们可以设置八组x,y点坐标来定义。在这种情况下,对于第一个x,我们从盒子宽度的30%开始,对于y,我们从盒子的顶部开始,然后顺时针设置各个点。可见区域就是通过将这些点用直线连接而形成的形状。 clip-path: polygon( 30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30% ); web前端开发学习Q-q-u-n: 784783012 ,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法 (从零基础开始到前端项目实战教程,学习工具,职业规划) 看不见的顶点 上面实现一个八边形,我们设置了八个点的坐标。但是,我们可以跳出元素框的限制去思考,也就是说要跳出0% - 100%的这个范围。 元素的盒边框是裁剪后内容的显示边界,但我们仍然可以为元素定义超出盒边框的点。 通过定义超过0%

CSS:颜色、背景和剪切

旧城冷巷雨未停 提交于 2019-12-15 21:05:27
颜色 CSS 中可以改变文字的颜色还有元素的背景颜色。可以用颜色关键字来定义颜色,如 red ,但是这些颜色关键字并不常用。 transparent transparent 可以让文字或背景变的完全透明的颜色,它就像 rgba(0,0,0,0) 的缩写。 currentColor currentColor 代表原始的 color 属性的计算值。比如当前元素 color 为红色,背景色设置为 currentColor ,那么现在背景色也为红色。 rgb、rgba 颜色还可以用 rgb 函数表示,如 rgb(255, 255, 255) 代表白色,它每个参数的取值范围是 0 到 255 ,它是用不同比例的红、绿、蓝来组成期望颜色。 rgba 函数代表红-绿-蓝-阿尔法,其中的 a 是透明度,取值范围是 0 到 1 。 除了使用 rgb 函数,还可以使用 16 进制来表示,它的语法是 #RRGGBB ,如果 #f3f3f3 ,代表 f3 (16 进制)数量的红-绿-蓝。如果红-绿-蓝数值两两相等,如 #ffffff ,就可以简写成 3 位 16 进制的形式 #fff 。在高版本的浏览器还可以用 16 进制表示透明度 #RRGGBBAA , AA 的取值范围是 0 到 255 ,如果两两相等也可以简写成 #RGBA 形式。 hsl、hsla hsl 函数是用色相-饱和度-明度(Hue

How to resize SVG clip-path?

二次信任 提交于 2019-12-14 04:25:12
问题 I am using an SVG as a mask for an image and I'm trying to resize it. I tried indicating the width & height (to 100) but it still doesn't scale. Just remains the same size. Codepen Demo This is the SVG code: <svg height="100" width="100"> <defs> <clipPath id="svgPath"> <path fill="#EDEBEA" d="M468.855,234.292H244.117V9.439L468.855,234.292z" /> <path fill="#EDEBEA" d="M6.864,8.939h224.73v224.733L6.864,8.939z" /> <path fill="#EDEBEA" d="M244.118,469.73V245.005h224.737L244.118,469.73z" /> <path

Clip Path is always overflow:hidden

情到浓时终转凉″ 提交于 2019-12-13 15:30:22
问题 I made this example: div { -webkit-clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%); clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%); background-color: red; width: 150px; height: 150px; position: relative; } ul{ position: absolute; background-color: green; left: 30px; top: 50px; } <div> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> <li>10</li> </ul> </div> As you can see, there is a list with 10 numbers but due to clip path

shape-outside property not working at all

假如想象 提交于 2019-12-13 08:41:49
问题 I have just started trying out the shape-outside property in css but I am not able to make it work,no matter how many documentation or blogs I go through. I may have done a silly mistake but I am not not sure about it. Can someone point out the mistake? #q { background-color: #E6C9C9; /*height: 100%; width: 100%;*/ float: left !important; -webkit-shape-outside: circle(50%); shape-outside: circle(50%); } <html> <head> <title>Testing Split Div</title> <link rel="stylesheet" href="https://maxcdn

CSS next & previous clip path animation

≡放荡痞女 提交于 2019-12-12 05:19:44
问题 Following on from a related question that I posted last week, I have created a custom carousel that uses clip-path to provide a snippet of the next and previous slides. This is currently working functionally, but I now need to apply some animations when showing/hiding the slides. In the related question, only the "next slide" functionality was needed, and a solution that was provided was to clip the "active" slide. However now since we need to do next and previous slides, I have applied the

How to make suitable border and shadow for a widget created by CustomClipper

孤街浪徒 提交于 2019-12-11 17:08:51
问题 I have a Container widget inside of a ClipPath which uses a CustomClipper . Everything works fine, I have the desired widget shape. However, I could not find a way to make a shadow for this custom shaped Widget. Also, I want to have an outline(border) that follows the edges of this custom widget automatically. Again no luck. I tried BoxDecoration:border , BoxDecoration:boxShadow , ShapeDecoration:shape , ShapeDecoration:shadows , Material:Elevation , etc.. 回答1: Look at source code of the

Fix the position of a clip-path or mask

女生的网名这么多〃 提交于 2019-12-11 10:59:18
问题 I have this interface concept and I just don't know if it's possible. It's kinda hard to explain so I sketched it out. I think I know how to accomplish some behaviour: <header> position: fixed; <nav> position: sticky (with a polyfill) <section class="content box"> --- no idea really I was hoping there would be some kind of way to add a clip-path to the content box that I could position: fixed. So that when the user scrolls the content box would peep trhough the area which was defined by the

How can I remove the non-visible part of `clip-path`?

给你一囗甜甜゛ 提交于 2019-12-11 04:24:20
问题 I would like to cut out images that vary in size at a height of 50% each. So I thought about using the inset method of the clip-path property. But, in this property, the cut out space remains as height. .container { display: flex; align-items: start; } .img { flex: 1; background: #900; } .img+.img { margin-left: 5px; } img { max-width: 100%; width: 100%; clip-path: inset(0 0 45% 0); } <div class="container"> <div class="img"> <img src="https://via.placeholder.com/300x550/009/fff.png" alt> <