Eliminate the standard border line from a div element

While working on creating shapes in React using CSS, I encountered an irritating issue with a ring design that I'm attempting to create. I can't seem to get rid of the default border around the circle shape I've created. I've tried using "outline: none" and "border: none", but I actually need a border for this design. It's puzzling whether this is a browser-specific problem or something else entirely.

Here is the React component I have been working on:

export default function Ring(props) {
 return <div className={`ring ${props.size} ${props.color}`}></div>;
}

And here are the corresponding styles for my ring component:

.ring {
  border-radius: 50%;
  z-index: -1;

  &.medium {
    height: 500px;
    width: 500px;
    border-width: 80px;
  }
  &.main {
    border-color: $main-color;
  }
  &.gray {
    border-color: $soft-gray;
  }
}

I would greatly appreciate any help or advice on how to resolve this issue!

https://i.sstatic.net/Z4hsX.png

Answer №1

The visible border is actually caused by the default focus effect applied by the browser using the outline style. To eliminate this focus indicator, simply include a CSS rule of outline:none;. This will retain the border appearance without the distracting blue outline, preventing the element from capturing focus with the blue border.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to display pre-selected information using MUI datagrid's checkboxSelection feature

I am currently working on a React web application and using a DataGrid component. I need to have certain rows pre-selected in the DataGrid just like they were selected previously by the user. https://i.sstatic.net/1iILu.png At the moment, the user has acc ...

I seem to be having trouble properly sizing the width of my forms in Mui React

Having trouble with the sizing of my tabs in a project I'm working on. The first tab displays ingredients, while the second tab allows for adding new ingredients with various forms. However, when selecting different forms, the width of the form contai ...

Instructions on setting a photo as a background image using a text-based model

I'm a beginner with Angular so I may have a simple question. I am using an image from the Google API, which is not a URL. How can I set this image as the background-image in a CSS tag that only accepts URIs? Thank you! ...

Tips for notifying a user prior to navigating back using the browser's back arrow in NextJS

Within my NextJS application, there is a page that displays a modal based on the presence of a query parameter. The modal opens when the query parameter is set and closes when it is not present. Since the modal contains a form, I need to notify the user i ...

The fixed position div remains stationary as the page scrolls

Below, I am attempting to fix the position of the 'inner-navigation' div within the 'compare-display' box by making it absolutely positioned. However, when scrolling, the 'inner-navigation' div is not staying fixed. How can I ...

Implement a mechanism for updating a child property whenever the parent state changes

In my setup, there's a parent state that includes a 'Theme' state. Current layout looks like this: The Parent Component holds the state of Theme. The Parent component passes down the current state to the child component as a "theme" prop ...

Difficulty with spacing in HTML/CSS styling

Here is what I'm currently working on: link to jsfiddle code * { margin: 0; padding: 0; } html { height: 100%; } header, nav, section, article, aside, footer { display: block; } body { font: 12px/18px Arial, Tahoma, Verdana, sans- ...

What is the correct way to effectively integrate react-hook-form with redux and typescript?

After tirelessly searching for a comprehensive guide that could demonstrate all these requirements in one example, I eventually resorted to brute force to make something functional. However, I am well aware that this approach is not the correct way to achi ...

Utilizing React with Typescript to access specific props

I am a newcomer to React and TypeScript and I am facing a challenge while trying to enhance an existing component by creating a wrapper around it. The issue I am encountering is related to adding my custom values to the properties. My goal is to extend th ...

Utilizing the hcSticky plugin for creating a scrolling effect on webpage content

I'm attempting to utilize the JQuery plugin, hcSticky, in order to achieve a scrolling effect on my fixed content. However, I seem to be encountering some difficulty getting it to function properly. What could I possibly be doing incorrectly? JSFIDDL ...

Manifest file: Error detected at the beginning of line 1 and column 1 while using Chrome browser

After building my React app using npm run build, I encountered an issue where GET and POST requests from the front-end to back-end were returning a status of 200. However, there was a strange error causing all the images from my files not to appear on loca ...

Having trouble with my JavaScript onClick function in obtaining the expected output value

Hey there, I've encountered an issue where using a loop to iterate through an array and check the onclick function results in all array elements producing the same result when clicked. The expected behavior is for only the first element's result ...

The nested element's margin causes the surrounding parent element to be nudged instead of creating space away from it

I am confused by the unexpected output I am seeing. I had set the paragraph elements to be 100px away from all sides, but it seems that they are not positioned correctly in relation to the main element. The top and bottom margins of the main element are ca ...

The battle of speed: ReactJS showdown between componentWillMount and render functions

export class Dashboard extends React.Component<DashboardProps, IMonthlyCommission>{ constructor(props) { super(props); this.state = {}; } componentWillMount() { request.get("AffiliateCommissionStatement/GetCommis ...

Two divs positioned to the right on top of each other

I want to align two divs on the right side of their parent div, one above the other. Here's a visual representation: div#top |-------------------------------------||------------| |div#parent ||div#menu | | ...

The :before pseudo element doesn't seem to be functioning properly on Internet Explorer 11

The following code works well in Chrome and Mozilla, but unfortunately does not function correctly in IE11. I am attempting to apply a background color on hover to a div with the class .border-green, however this functionality is failing specifically in ...

MiniCssExtractPlugin is failing to generate the CSS file as expected

Having issues with CSS Modules not working while implementing server side rendering with React/Node. Recently added mini-css-extract-plugin to separate CSS from JS, but the plugin is not generating a CSS file in the public directory. /package.json { . ...

I have successfully implemented useLazyQuery in a functional component, but now I am looking to integrate it into a class component. Can you provide guidance on how to achieve

Recently, I encountered an issue with my functional component that contains 3 checkboxes and 1 button. I utilized the useLazyQuery hook to ensure that my query was only sent upon clicking the button. However, a major drawback is that my component re-rend ...

"Delve into the art of utilizing negative space between elements with

Looking to implement hover detection between rows in a grid container, rather than on individual items. The number of items in the container and per row may vary. https://i.sstatic.net/yBgKI.png It's important to note that the item count in the cont ...

Implementing MUI createTheme within Next.js

After switching from material-UI version 4 to version 5.5.0 in my project, I encountered issues with createTheme. The colors and settings from the palette are not being applied as expected. Current versions: next: 11.0.0 react: 17.0.2 mui : 5.5.0 theme. ...