css-shapes

draw angular side / parallelogram using CSS

我怕爱的太早我们不能终老 提交于 2019-11-27 14:26:20
Need to draw angular sides of menubar as inner content may be the some labels or links. How about using CSS3 transform skew ? Demo .shape { width: 200px; height: 50px; -webkit-transform: skew(30deg); -moz-transform: skew(30deg); transform: skew(30deg); background: #000; margin: 20px; } Nothing much to explain here, it's a simple div element, which I've skewed by 30deg which will result in the shape you expected. Note: It's a CSS3 property, so older browsers, as well as IE will spoil your things, make sure you use CSS3 Pie . Other way to achieve this is by using :after and :before pseudo and

Create a triangle with CSS?

爷,独闯天下 提交于 2019-11-27 13:44:07
How can I create the following shape with CSS? I tried this to be a solution: .triangle:after { position:absolute; content:""; width: 0; height: 0; margin-top:1px; margin-left:2px; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid white; } .triangle:before { position:absolute; content:""; width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-bottom: 12px solid black; } You can see it working at Triangle . This is working, but with a trick of borders. Is there another way it could be done? Using

Using CSS and HTML5 to create navigation buttons using trapezoids

若如初见. 提交于 2019-11-27 13:36:56
问题 I'm trying to make a navigation-div with 4 buttons, one to go left, one to go right, another one to go down and yet another one to go up. Plus there needs to be an OK-button in the middle. The buttons need to be positions that they form any (the size is not set) rectangle, inside the buttons are positions on the very right, left, top and bottom, and each of them are trapezoids, leaving a square in the middle for the OK-Button. Just like that: What I've done is, that I created a trapezoid

Is it possible to draw a partial circle outline in CSS (open ring shape)?

扶醉桌前 提交于 2019-11-27 13:11:52
I'm interested in creating a loading spinner entirely in CSS but in order to do so I would need to be able to draw a open ring shape like this: The ring would draw itself around the circumference of the circle. Is this achievable in CSS? To create a circle that gradually draws it's outer path, use SVG. SVG's stroke-dasharray property will turn any path into a dashed line, which you can use to your advantage by setting the dash size to be almost as long as the path itself. Then use a CSS animation to gradually change the stroke-dashoffset to move the dash around the perimeter of your circle.

Half circle with CSS (border, outline only)

隐身守侯 提交于 2019-11-27 12:59:15
I'm trying to create a circle with CSS, which looks exactly like on the following picture: ...with only one div : <div class="myCircle"></div> and by using only CSS definitions. No SVG, WebGL, DirectX, [...] allowed. I've tried to draw a full circle and fading half of it with another div , and it does work, but I'm looking for a more elegant alternative. You could use border-top-left-radius and border-top-right-radius properties to round the corners on the box according to the box's height (and added borders). Then add a border to top/right/left sides of the box to achieve the effect. Here you

CSS Zigzag Border with a Textured Background

为君一笑 提交于 2019-11-27 12:54:20
I've been working on a header with a zigzag border. One way to do this is to use images to make the zigzag effect. (1) Is there any way to create a practical cross-browser zigzag border in CSS without the use of images? I am also trying to put a textured background on this header that extends to the zigzags. However, the vertical size of the header may change and I am unable to implement the header as a single image. If I try to add a texture to both the zigzag edges and the header element, chances are, the texture will be off sync. (2) Any ideas on implementing a textured background that

How to create triangle shape in the top-right angle of another div to look divided by border

↘锁芯ラ 提交于 2019-11-27 12:37:55
I want to create shape like on this picture: I created triangle shape like on this pic, and set the margins to be in top right angle, but I dont know how to make it look divided from the left div like shown on picture. Do I have to "cut" left div to remain it's grey border and to look divided from green triangle? Is there any idea how to do this? EDIT: I am using fixed navigation bar on page, so when i scroll if div is position:absolute, navigation bar goes behind div. space between green triangle and rest of div should be transparent, because i am using image as page background David Thomas I

Circle with two borders

人走茶凉 提交于 2019-11-27 12:10:35
问题 How can I style a a circle (a div ) with two borders responsively so that it reacts to a container's size? Suppose circles like this for example: Here is a working CSS for a circle: div.circle { width: 90%; height: 0; padding-bottom: 90%; margin: auto; float: none; border-radius: 50%; border: 1px solid green; background: pink; } <div class="circle"></div> How can I add a border with two colors ? I tried outline but it came out as a rectangle. I tried to place another div inside the circle div

how to handle 'double opacity' of two overlapping divs

…衆ロ難τιáo~ 提交于 2019-11-27 12:04:23
I have two divs, both with 0.6 opacity. I need them to overlap but retain their opacity and not create a new combined opacity level. I can't use an image. EDIT -- The little circle is supposed to have a canvas element in it. Not sure if pseudo-elements would be the best solution. Is there anyway to do this with CSS, or should I just use canvas? example - http://dabblet.com/gist/1566209 HTML: <div id="foo"> <div id="bar"> </div> </div> CSS: /** * Double Opacity */ body{background:green;} #foo{ height:150px; width:250px; background:rgba(0, 0, 0, 0.6); position:absolute; left:40%; top:20%; } #bar

How do I create a circle or square with just CSS - with a hollow center?

冷暖自知 提交于 2019-11-27 11:06:27
问题 It should just basically be an outline of the square or circle - that I can style accordingly (i.e. change the color to whatever I want, change the thickness of the border, etc.) I would like to apply that circle or square over something else (like an image or something) and the middle part should be hollowed out, so you can see the image beneath the square or circle. I would prefer for it to be mainly CSS + HTML. 回答1: Try This div.circle { -moz-border-radius: 50px/50px; -webkit-border-radius