Creating a semi-circular shaped rectangle using CSS

Is it possible to achieve the unique rectangle borders shown in the image using border-radius or any other CSS property? Here's what I'm trying to create:

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

Currently, this is what I've been able to achieve using border-radius:

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

The top rectangle was generated using Wix, while the second one was created using CSS and HTML. The border styles look quite different as you can see.

Is there a way to replicate the unique border design?

Answer №1

Creating unique shapes using border radius values is a great way to customize your design. By defining each corner individually, you can achieve a variety of shapes. Here is a simple example to illustrate this concept. For more information, you can refer to this link: https://www.w3schools.com/cssref/css3_pr_border-radius.asp

#rcorners {
  border-radius: 4em / 2em;
  background: #73AD21;
  padding: 20px;
  width: 200px;
  height: 150px;
}
<div id="rcorners">Rounded corners!</div>

Answer №2

Consider using the following code snippet: border-radius: x/y, where x represents the larger value for the corner you desire

.example {
        margin: auto;
        width: 400px;
        height: 100px;
        background-color: blue;
        border-radius: 30%/10%;
    }
<div class="example">
</div>

Answer №3

To adjust both the horizontal and vertical radius, use the following CSS code: border-radius: 50px/20px;

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

Take a look at this demonstration:

div.example {
    background-color: #6495ED;
    padding: 20px;
    margin-top: 10px;
    margin-right: 20px;
    text-align: center;
    border-radius: 50px/20px;
}
<div class="example">Lorem Ipsum.</div>

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

How can recursive data be displayed in a template?

I am working with a model in Django that has a ForeignKey pointing to itself, and I need to display all the data from the database using lists and sublists: Below is my model definition: class Place(models.Model) name = models.CharField(max_length=1 ...

Having issues with Inline-Block functionality?

I am facing alignment issues with an image and a container placed next to each other. The rest of my website uses inline-block without any problems. If someone could provide guidance on how to resolve this, it would be greatly appreciated. Below is the s ...

What is the best way to create clickable <tr> elements that function as links rather than cells?

Although it seems simple, I am struggling to achieve this task. I have a list of rows with 6 columns that display data from MySQL. I want to make each row clickable instead of just a cell, which will open a new URL in a new tab. Below is the structure I ...

Is dividing a container into equal sections possible with flexbox?

Is there a way to create an HTML/CSS structure that divides a fixed-size container into three sections horizontally? The first section should expand based on its content, while the remaining two sections should evenly split the leftover space, with scrollb ...

Accessing the phone number input from a form in Rails and verifying its presence in the database. Implementing distinct ajax responses based on the existence of the value

Looking for a way to verify phone numbers? The process involves users entering a phone number, submitting the form, and cross-referencing it with a database of phone number records to determine if it's valid. My goal is to provide different AJAX respo ...

Using jQuery's .load() function to exclusively receive image bytecodes

I am utilizing jQuery's .load() function to receive the bytecode of loaded images. Could it be due to a lack of specified MIMEType? because I'm using an image URL without a file extension? necessary to wrap the entire operation somehow? Here& ...

Steps for adding a Bootstrap Navbar Dropdown1. Begin by creating

Looking for tips on how to incorporate a dropdown navbar using Bootstrap 4. I've utilized the .navbar-bottom class to achieve a horizontal layout.** The .navbar-bottom class is used to include a scrollbar in the navbar** .navbar-bottom { overflow ...

Tips for locating and clicking a specific table element using Selenium

Is there a way to dynamically click the link associated with the label in this specific td? I am able to locate the link using the onclick method, however, the label name changes periodically from HemoGlobin A1C to HGB A1c, etc. and there is no unique ID ...

New alternative for form-control-feedback in Bootstrap 4

The form-control-feedback class doesn't appear to be included in Bootstrap 4. What is the most effective way to achieve the desired outcome (an icon inside the textbox) using Bootstrap 4? <head> <link rel="stylesheet" href="https://max ...

Verify that all images retrieved through AJAX have finished loading before proceeding

Is there a way to ensure all images in the HTML loaded via AJAX are fully loaded before performing an action like displaying them? I've experimented with various methods, including using the 'imagesloaded' plugin. var page = 'P40&apos ...

Hover over the text to reveal its content

I am currently in the process of developing a website that features interactive images with text appearing when hovered over. This concept is inspired by the functionality on the nowthisnews.com site. Despite my efforts, I have been unable to get this fea ...

Utilize a variable within an HTML attribute

Currently utilizing Angular and I have the following HTML snippet <input onKeyDown="if(this.value.length==12 && event.keyCode!=8) return false;"/> Is there a way for me to incorporate the variable "myNum" instead of the ...

What is the best way to place an <a> tag and a <p> tag side by side in an HTML

I have a question on organizing this HTML code: <ol class="results-list"> <% @results.sort_by { rand }.each do |result| %> <li class="<%= 'checked-out' if result.catalog_item.library_status == 'Checked out&apos ...

Footer flexbox element not aligning underneath other content containers

After creating a layout using CSS and Flexbox, I encountered an issue with the footer div. When the page loads, the footer is displayed at the bottom of the page. However, as content is added or loaded dynamically, it causes the footer to float in the midd ...

Sophisticated method in JavaScript to conceal and reveal div elements

My knowledge of front-end web development is strongest in HTML and CSS, but when it comes to JavaScript, I feel like there must be a more efficient way to achieve the functionality I want. On my website, I have a set of <li> items that, when clicked ...

Choose or deselect images from a selection

I am currently working on a feature for an album creation tool where users can select photos from a pool of images and assign them to a specific folder. However, I'm facing difficulty in selecting individual photos and applying customized attributes t ...

Language translation API specifically designed to convert text content excluding any HTML formatting

I have a dilemma with translating text content in an HTML file into multiple languages based on user input. To accomplish this, I am utilizing the Microsoft Translator AJAX interface. The structure of my HTML file looks something like this; <h1>< ...

Disabling the scrollTop() effect following a click event with onClick()

Utilizing the scrollTop() event to toggle the visibility of a div at a specific position and also using the onClick() event to permanently hide the div. While the events are functioning properly, an issue arises when scrolling the page causing the div to r ...

JavaScript: create a button that dynamically changes size and color when scrolling

I have a pulsing button (#scrollarrow) at the bottom of my website that disappears as I start scrolling. The jQuery code responsible for this effect is as follows: $(document).ready(function(){ $(window).scroll(function(){ if ($(thi ...

How can one effectively style text to appear italic using CSS and HTML?

What is the proper method to italicize text? I have come across these four different approaches: <i>Italic Text</i> <em>Italic Text</em> <span class="italic">Italic Text</span> <span class="footnote">Italic Tex ...