logo
down
shadow

How to use CSS to give a circle a "partial border"


How to use CSS to give a circle a "partial border"

By : Terry Flander
Date : November 21 2020, 03:00 PM
Hope that helps You can use a combination of:
clip-path: polygon() border-radius ::before pseudo-element
code :
body {
width: 420px
}

.circle {
position: relative;
float: left;
width: 112px;
height: 112px;
margin: 6px 6px 12px 6px;
padding: 6px;
background-color: rgb(255, 0, 0);
border-radius: 50%;
}

.circle::before {
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
width: 124px;
height: 124px;
background-color: rgb(255, 255, 255);
}

.circle::after {
content: '';
position: absolute;
top: 0;
left: 0;
display: block;
width: 100px;
height: 100px;
margin: 12px;
background-color: rgb(255, 255, 0);
border-radius: 50%;
}

.circle:nth-of-type(1)::before {
clip-path: polygon(0% 0%, 100% 0%, 100% 50%, 50% 50%, 50% 100%, 0% 100%);
}

.circle:nth-of-type(2)::before {
clip-path: polygon(0% 0%, 100% 0%, 100% 30%, 50% 50%, 30% 100%, 0% 100%);
}

.circle:nth-of-type(3)::before {
clip-path: polygon(0% 0%, 100% 0%, 100% 10%, 50% 50%, 10% 100%, 0% 100%);
}

.circle:nth-of-type(4)::before {
clip-path: polygon(0% 0%, 50% 0%, 50% 100%, 0% 100%);
}

.circle:nth-of-type(5)::before {
clip-path: polygon(0% 0%, 30% 0%, 50% 50%, 30% 100%, 0% 100%);
}

.circle:nth-of-type(6)::before {
clip-path: polygon(0% 0%, 10% 0%, 50% 50%, 10% 100%, 0% 100%);
}

.circle:nth-of-type(7)::before {
clip-path: polygon(0% 10%, 50% 50%, 0% 90%, 0% 100%);
}

.circle:nth-of-type(8)::before {
clip-path: polygon(0% 30%, 50% 50%, 0% 70%, 0% 100%);
}

.circle:nth-of-type(9)::before {
clip-path: polygon(0% 45%, 50% 50%, 0% 55%, 0% 100%);
}
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>


Share : facebook icon twitter icon
How do I move the circle to the "WEST" border layout frame?

How do I move the circle to the "WEST" border layout frame?


By : Sreenu RK
Date : March 29 2020, 07:55 AM
will help you I'm not really sure I understand what this GUI should be doing, but this works to move the circle to the left. Points 3) & 4) of my comment still need to be addressed.
Here is the altered code.
code :
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Lab2 extends JFrame {

Lab2(){
    setTitle("Lab 1b - Application #2");
    Lab2Panel p = new Lab2Panel();
    add(p);
}

public static void main(String[] args){

    Lab2 frame = new Lab2();
    frame.setTitle("Lab2 Application # 1");
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 400);
    frame.setVisible(true);
    }

}

class Lab2Panel extends JPanel{
Lab2Button canvas = new Lab2Button();
JPanel panel = new JPanel();

Lab2Panel () {

    setLayout(new BorderLayout());

    JButton leftButton = new JButton("left");
    JButton rightButton = new JButton("right");
    JButton upButton = new JButton("up");
    JButton downButton = new JButton("down");

    panel.add(leftButton);
    panel.add(rightButton);
    panel.add(upButton);
    panel.add(downButton);

    this.add(canvas, BorderLayout.CENTER);
    this.add(panel, BorderLayout.SOUTH);

    leftButton.addActionListener(new Lab2MoveBallListener(canvas));
}


}

class Lab2Button extends JPanel {
int radius = 5;
int x = -1;
int y = -1;

protected void paintComponent(Graphics g){
    if (x<0 || y<0) {
        x = getWidth() / 2 - radius;
        y = getHeight() / 2 - radius;
    }
    super.paintComponent(g);
    g.drawOval(x,y, 2 * radius, 2 * radius);

}

        public void moveLeft(){

            //this.add(this, BorderLayout.WEST);
            x -= 5;
            this.repaint();
        }


}

class Lab2MoveBallListener implements ActionListener{
    private Lab2Button canvas;

Lab2MoveBallListener(Lab2Button canvas) {
    this.canvas = canvas;
}

public void actionPerformed(ActionEvent e){
    canvas.moveLeft();
}
}
(mobile web development) how to make a circle with "border-radius:50%" when its width is percent 80%

(mobile web development) how to make a circle with "border-radius:50%" when its width is percent 80%


By : Steveo
Date : March 29 2020, 07:55 AM
Hope this helps I used to make a circle with "width:100px;height:100px;border-radius:50%" in PC; But there is something wrong when I do the same thing in mobile, because the width in PC is "px", the width in mobile is "percent", so I can't ensure the width and the mobile in mobile is same; , Just add padding-top with the same value as your width.
code :
div {
  border:1px solid #ddd;
  border-radius:50%;
  width:80%;
  height:auto;
  padding-top: 80%; /* value same as width */
}
How to apply the "rounded-circle" in css? border-radius:50% not works

How to apply the "rounded-circle" in css? border-radius:50% not works


By : Jeff Kidzie
Date : March 29 2020, 07:55 AM
this one helps. You could simply try an image with a dark background or simply add a border to see how round the image with a white background
code :
img{
  border-radius:50%;
  width:300px;
  height:300px;
  border: solid 1px black;
}
<img src="https://csform.com/wp-content/uploads/2018/06/Ionic-App-Dark-UI.jpg">

<img src="https://luisjordan.net/wp-content/uploads/2017/04/logo-ionic.jpg">
Having "border-radius: 100%;" as an IDEAL circle when font size changes

Having "border-radius: 100%;" as an IDEAL circle when font size changes


By : user3529302
Date : March 29 2020, 07:55 AM
To fix the issue you can do As I know, You have three options:
SVG way: draw the circle via svg, but you need to put a number in the circle. Then You can use svg::before or ::after and z-index. SVG circle
code :
  [2]: https://codepen.io/juricon/pen/eYmRVPQ    
How can I give my GitHub repository multiple coloured-circle "technology badges"?

How can I give my GitHub repository multiple coloured-circle "technology badges"?


By : CarlHinderer
Date : March 29 2020, 07:55 AM
Any of those help The coloured circle you see does not list technologies used, it shows the repository language. This is usually the language that has the most code in your repository, and only one language will be visible.
The language is determined by the Linguist library, and you have the option of fixing it if it is detected incorrectly or overriding defaults (e.g. ignoring certain files, such as data files), if necessary.
Related Posts Related Posts :
  • Can anyone see where I'm going wrong with this srcset?
  • Why is this SVG so blurry?
  • Dynamic multiple charts in chart.js with dynamic data inside them
  • How to set equal amount of spacing from the font awesome icon or text using css
  • Empty input shown as brackets when using RenderControl ASP.NET VB HTML
  • Bootstrap - section and div positioning
  • Easy HTML button "border"
  • Jumping background
  • align icon on top of text inside button tag
  • Working with local language in HTML
  • Mobile responsive design--> Img-responsive not working
  • Display a fix number of row item depending on screen size using bootstrap
  • EditorConfig for VS Code not working
  • Make second image 50% smaller than first with CSS
  • CSS Align logo same height as text
  • How can I write this layout with flexbox?
  • Truncating an individual block of text within a list item
  • Making Wordpress Site 100% Browser Width
  • Move links within a navbar
  • Float div left and button right
  • Vertically and horizontally centering two items within a parent div that is part of a flex-row
  • Why images and text with links keep moving on hover
  • How do I make different buttons in css?
  • Input border effecting the position of span why?
  • bootstrap.min.css X in top right corner
  • Why can browsers infer certain omitted HTML elements, but not all omitted elements required to form valid markup?
  • Strange behaviour involving Closure commands and "text-align:justify"
  • Using html, css to create a google search page look alike
  • Get button to hover over image
  • flexbox prevent wrapping of rows
  • Float left vs float right - why does the order change?
  • css vertical align not working correctly
  • Bootstrap 4 grid issue
  • Eliminate margin when commenting
  • CSS Properties rules are not working in HTML file
  • Position footer div at bottom inside table-cell with 100% width
  • How to align one element to bottom and other one to top in bootstrap 4
  • Using Bootstrap, how do I center my navigation bar?
  • VBA Excel Content into HTML (create an HTML file from Excel)
  • minimum height of div and contents at least 100%
  • Absolute position div goes out of window when opening console
  • Make my background-image in the middle
  • Bootstrap col-sm-6 icons alignment
  • Nav bar won't stay in header when made smaller. How can I achieve this?
  • How to right align a hyperlink in a <div>?
  • Links with tables doesn't quite work
  • How to make <tr>'s height of position:fixed column follow its content's height?
  • Is an empty meta refresh tag ignored or equivalent to 0?
  • CSS How can I make this height responsive?
  • DIV moves when it has children elements
  • How to set first table column as bold (CSS)
  • Bootstrap Fieldset Legend is getting Covered by Panel Panel-default completely
  • Blogspot remove black line above posts
  • Usage of picture tag for svg types
  • Angular 4 toggle fontawesome button inside ngFor
  • CSS code not working on one single page
  • Place footer on bottom page while printing
  • Google maps API doesn't change language
  • Fade out previous :target after :target changed
  • Display flex, make image same height with another columns
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org