Button design featuring inverted half circles on each side created using HTML and CSS

Thinking of designing a unique button with inverted half circles on either sides.

I attempted to make a half-circle and include it at the button's end, but the result didn't turn out quite like I hoped.

Envisioning something similar to this:

button featuring half circles on both ends

Answer №1

To achieve this particular design, you have the option to utilize CSS after and before Pseudo-Elements or make use of the CSS shadow property. Below, you can find a code example demonstrating the usage of CSS after and before Pseudo-Elements.

Click here to view the code snippet on CodePen.

HTML

<button class="circled-button">
  Button
</button>

CSS

.circled-button {
  background:#000;
  box-shadow:0px 0px 0px;
  border:0px;
  padding:20px 15px;
  min-width:250px;
  position:relative;
  overflow:hidden;
  color:#fff;
  font-size:20px;
  border-radius: 9px;
}
.circled-button:after {
  content:'';
  display:block;
  width:20px;
  height:20px;
  border-radius:50px;
  position:absolute;
  left:-9px;
  background:#fff;
  top:50%;
  transform:translateY(-50%);
}
.circled-button:before {
  content:'';
  display:block;
  width:20px;
  height:20px;
  border-radius:50px;
  position:absolute;
  right:-9px;
  background:#fff;
  top:50%;
  transform:translateY(-50%);
}

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

Utilize Bootstrap rows and columns to extend the column color to the bottom of the page

I'm having trouble getting the background color of a bootstrap col to extend to the bottom of the page without setting a fixed height. I want it to reach all the way to the bottom of the browser screen. HTML: <div class="container"> <div ...

Tips for centering text with a Bootstrap switch

Currently, I am in the process of creating a form using Bootstrap, and I have been progressing well, except for one issue. I want to integrate a switch type checkbox into the form, with a label on top and text on either side of it. Despite several attempts ...

Updating the value of a Redux-Form Checkbox Field using programming methods

I have created a registration form where users can accept or decline the terms of services. When a user accepts the terms, they click a button to check the checkbox. If they decline, the button will uncheck the checkbox. https://i.sstatic.net/mfkcY.png ht ...

What is the best way to position my image on the right side of the page?

Trying to position an image on the right side, but facing issues with overlapping social media icons when using the pull-right class in bootstrap. Desired image layout:https://i.sstatic.net/tyfjW.png UPDATE: For reference, here is a link to the header i ...

What if we started using PT as the standard unit for measuring fonts and element size?

Currently, I am in the process of creating a mobile app that will work across different platforms using jQueryMobile and PhoneGap. My initial focus is on developing for Android. When it comes to Android app development, it is recommended that developers u ...

Using Angular JS to retrieve specific information from a JSON file

I am in the process of developing an AngularJS app that showcases notes. The notes are stored in a note.json file, and the main page of the app only displays a few fields for each note. I want to implement a feature where clicking on a specific note opens ...

Adjust the width of the floating division

I'm facing an issue with a div structure that contains two other divs displayed like this: ---------------------------- | | | | | | | div 1 | div 2 | | | | | ...

Control the transparency of the initial parent div that includes an *ngFor loop

I want to add opacity only to the first div which contains an icon and a heading in another nested div. The second div should remain fully visible (opacity: 1). Here is the HTML structure: <div class="row clearfix"> <div class="col-lg-3 col- ...

What is the best way to center a Bootstrap login form within the viewport?

Struggling to get the login view centered on the screen, no matter what I try. As a newcomer to Bootstrap and coding, it's proving to be a challenge. Attempts to use align items center and justify haven't yielded the desired result. <h2 style ...

Determining Text Color Based on Background Hue

Is it possible to create a div that dynamically changes text color based on the background color surrounding it? I want the text to switch between two different colors, with the font color being the opposite of the background color. For example, black text ...

Steps for creating a node.js and ejs file to deploy on 000webhost

I have developed a simple todo-app using node.js and ejs templating. My goal is to host it using 000webhost, a free web-hosting service. I successfully hosted a react app for free on this platform by running "npm run build", which converted the ...

Step-by-step guide on eliminating the modal post-validation

Newbie in reactjs looking for help with modal validation issue. Goal: Press submit button inside modal, validate, then close the modal. Want to reuse modal for another row. Problem: I'm having trouble making the function work for a new row after ...

What is the proper way to call document methods, like getElementByID, in a tsx file?

I am currently in the process of converting plain JavaScript files to TypeScript within a React application. However, I am facing an error with document when using methods like document.getElementById("login-username"). Can you guide me on how to referen ...

The error message "TypeError: window.Razorpay is not a constructor" indicates that

I am attempting to integrate RazorPay into my React app, but I am encountering the following error: https://i.stack.imgur.com/iFvdz.png Here is the code snippet: import TshirtImg from "./tshirt.jpg"; // import Razorpay from 'razorpay' ...

anticipating the completion of useEffect and subsequently retrieving object properties

I'm struggling with the following code: const [files, setFiles] = useState([]); const [greeting, setGreeting] = useState(0); const [menu, setMenu] = useState([]); const [options, setOptions] = useState([]); var customer_id = 1; useEffect(() => { ...

What is the best way to ensure that my React-Tailwind navbar and hero elements are optimized for screen height?

I'm facing a challenge with my current project, which is a React project integrated with Tailwind CSS. I'm attempting to style the main elements (navbar and hero) to fit the entire screen height when the user lands on the page. If you have a solu ...

Are CSS designers setting boundaries for their designs by restricting themselves to layouts that can be handled by CSS from the start?

After seeking guidance on reaching CSS zen in this forum, I have come to realize that my struggles largely stem from positioning. Some sources suggest that CSS may not always be the most efficient layout system. As CSS designers, do we limit ourselves fro ...

Discovering the method to retrieve the information of the selected item in AngularJS

My table is using the ng-repeat in the <tr> element to load content dynamically from a JSON file. Each row has a unique ID in the table. I need a way to access the inner HTML of the respective row's ID column when it is clicked. Is there a solut ...

Problem with nested table columns not extending to full height of parent table

I'm currently facing an issue with my HTML table. The nested table on the right does not occupy the full height of the main table. Even if the content in the description column is short, I want the column to resize accordingly. I have tried various ...

Having trouble with your React Native code executing before completing the task? Learn about Promise.all() and how to handle asynchronous issues

I'm facing an issue with my set up where it runs through an array, saving it into the phone, but opening the googleUrl before all media files are downloaded. I thought Promise.all() should handle this situation. Shouldn't it wait for mapMediaArra ...