Create a div in HTML with a customized style to resemble a label with rounded edges

I'm struggling with CSS styling and trying to achieve a specific look for a div, as shown in the picture. Can someone provide guidance on how to achieve this style or share the necessary CSS code? I have come across similar buttons and div designs but haven't been able to find the exact CSS for this particular style.

https://i.sstatic.net/SonSL.jpg

Answer №1

.button{
border-radius:25%/100%;
border:1px solid #000;
background:#fff;
padding: 8px 15px;
font-size:14px;
}

.button span{
font-size:10px;
padding-left:5px;
}
<button class="button">sometext
<span>X<span>
</button>

Answer №2

.anotherbutton{
background-color: blue;
    border: none;
    border-radius: 10px;
    width: 30%;
    height: 40px;
    color: black;
}

give this css a shot!

Answer №3

Here is an example of how it can be done:

.customDiv
{
    border: solid 2px #000;
    border-radius: 25px;
    width: 20%;
    height: 35px;
    color: black;
    text-align: center;
}
<div class="customDiv">
Text Goes Here
</div>

Answer №4

For the solution in its entirety, please refer to: (https://jsbin.com/jigupenihi/edit?html,css,output)

.rounded-btn{
  background : #fff;
  padding: 20px 40px;
  display:inline-block;
  border: 3px solid #000;
  min-width: 150px;
  border-radius: 100px;
  text-transform: uppercase;
  text-align: left;
  font-family: verdana;
  font-weight: bolder;
  cursor: pointer;
}
.close{
  float: right;
}
 <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Button</title>
</head>
<body>
  <br>
  <div class="rounded-btn">SOME TEXT <span class="close">X</span> </div>
</body>
</html>

Answer №5

.custom-button{
border-radius:25%/100%;
border:1px solid #000;
background:#fff;
padding: 8px 15px;
font-size:14px;
}

.custom-button span{
font-size:10px;
padding-left:5px;
}
<button class="custom-button">sometext
<span>X<span>
</button>

.rounded-btn{
  background : #fff;
  padding: 20px 40px;
  display:inline-block;
  border: 3px solid #000;
  min-width: 150px;
  border-radius: 100px;
  text-transform: uppercase;
  text-align: left;
  font-family: verdana;
  font-weight: bolder;
  cursor: pointer;
}
.close{
  float: right;
}
 <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Custom Button</title>
</head>
<body>
  <br>
  <div class="rounded-btn">SOME TEXT <span class="close">X</span> </div>
</body>
</html>

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

What is the best way to make an ajax commenting system function from a separate directory?

I am facing an issue with implementing an ajax commenting system on my website. When I place all the code from the /comment directory directly in the root, everything works fine and the commenting system functions as expected on new pages. However, when I ...

Investigating the memory leak caused by jQuery/Sizzle when checking the

During the debugging process of my application with the 'Profiles' feature in DevTools, I noticed an accumulation of "Detached DOM tree's". These detached nodes contain a retaining tree primarily made up of checkContext functions (which orig ...

`Month filter functionality optimized`

I have a flirty plugin installed on my website and it's working great except for one thing: I'd like the month category to be filtered in chronological order instead of alphabetically. Is there a way to achieve this? In simpler terms, how can I ...

The attempt to execute 'removeChild' on 'Node' was unsuccessful because parameter 1 is not the correct type. Although it did remove the elements from the DOM, it only did so once

It's quite a challenge I'm facing!!! Although there have been similar questions asked before, they were all for specific scenarios. I am currently developing a tictactoe game using the module design pattern. The function below helps me create tw ...

The jQuery window.load() function fails to execute on iOS5 devices

I added a basic loading div to my website that fades out once the entire page has finished loading. The code I used is simple: $(window).load(function(){ $('#loading').fadeOut(500); }); While this works well on all desktop browsers and Chro ...

Transferring information between pages in PHP

Currently, I am exploring the most effective way to pass data between two pages (Page A to Page B) using PHP for a specific scenario: Page A: This page displays a gallery of images with titles. The PHP file makes a database call to an images table, which ...

Feature for jotting down notes, creating a break between lines without any information present

I'm currently working on implementing a note-taking feature for my web application. However, I have encountered two issues: Firstly, I am struggling to identify line breaks within the text. While I can hardcode text with line breaks, when a user clic ...

Troubleshooting: Form submission not triggering AJAX using JQuery

I'm attempting to implement some AJAX rendering when the form is submitted, but for some reason it's not functioning correctly. Upon submitting the form, I am redirected to the submit page. Here is my JavaScript code: $('#knappen').cl ...

Align headings h2 and h4 on the left and right sides of the same line, ensuring they are at an

I am attempting to create a header with h2 text on the left and h4 on the right, positioned on the same line with equal height and some padding. Here is the code snippet I have written: .alignleft { float: left; } .alignright { float: right; } .nav ...

Add small pieces of content to CKEditor

Is there a way to add "atomic" block content into CKEditor? For instance, I would like to add <h1>Test</h1> right after the letter "B" in the sentence <p>A B C</p>. Currently, when using CKEDITOR.currentInstance.insertHtml('&l ...

Can Material UI be utilized to design a Shopify e-commerce store?

As I prepare to create a Shopify storefront for the first time, I have a few inquiries. I have noticed how convenient it is to design both a mobile and desktop view using Material UI, but I have come across conflicting information online. Some sources su ...

Achieve this effect by making sure that when a user scrolls on their browser, 50% of the content is entered into view and the remaining 50%

Is there a way to achieve this effect? Specifically, when the user scrolls in the browser, 50% of the content is displayed at the top and the other 50% is shown at the bottom. ...

Pair up balls that have matching numbers

A software application was designed with the following features: It can create 4 balls on the screen, each containing a numerical value Users have the ability to input values for new circles to be generated Upon clicking a button, 4 new circles with num ...

Challenges related to a hamburger icon menu

Trying to create a functional hamburger menu but facing some difficulty in getting it right. Here's the concept: The page layout on larger screens should resemble this: https://i.sstatic.net/CBqMP.png Smaller screens will display a hamburger menu, ...

Using HTML input checkboxes in conjunction with a JavaScript function

After creating a basic payment form using HTML/CSS/JS, I wanted to implement checks on user inputs using HTML patterns. In addition, I aimed to display a pop-up alert using JS to confirm the form submission only after all necessary inputs are correctly fil ...

What is the best way to hide the select arrow in an input-group using Bootstrap 4?

Is there a way to get rid of the unsightly double arrow in the select element? I have tried various solutions I found online, but none seem to be effective. <div class="form-group"> <label for="date">Date</label> <d ...

Traffic signal color transitions without the use of a button

My objective is to have the following code run automatically without the need for user input. It should also execute in a loop instead of running through the sequence only once. I attempted to modify the code, but it either failed to work or altered the sh ...

Retrieve all HTML elements, including their closing tags, from a file with Java, without relying on external libraries such as Jsoup

Recently, I've been working on a piece of code that reads an HTML file, extracts all the opening HTML tags, and displays them. However, I have been thinking about how to also include the closing tags in the output. At the moment, the code prints: < ...

Preventing ElementNotVisibleException in Selenium WebDriver

Although I haven't delved into HTML extensively, I might not be entirely correct in what I'm about to discuss. As I was working on my Selenium code, I observed that certain buttons on specific webpages don't redirect to other pages but rath ...

Using Python and Django to trigger a Python function upon submitting a form using Ajax

Encountering an error while loading the app, specifically related to the URL in the form's action attribute. After hours of searching online and trying various solutions, I am still unable to resolve it. As a newcomer to Django, any assistance would b ...