What is the best way to insert a scroll into a section of a circular shape seamlessly?

Currently, my layout looks like this: https://ibb.co/iqaOXS

However, I would like it to look more like this: https://ibb.co/eDkCRn

The issue I'm facing is that the buttons are extending beyond the circular border. How can I prevent this from happening and keep them within the circle?

If possible, I would prefer a solution using CSS and HTML only, but I am open to any suggestions!

Here is the code I have so far:

#one {
    border: 2px solid black;
    border-radius: 50%;
    height: 90px;
    width: 90px;
}

#unu {
    overflow: auto;
    position: absolute;
    top: 20px;
    height: 60px;
    width: 80px;
    border: 2px solid transparent;  
}

button {
    width: 65px;
    height: 40px;
}
<div id="one">
    <hr style="width: 60px;">
    <hr style="position: absolute; left: 15px; top: 74px; width: 70px;" >
    <div id="unu">
        <button>
            <p>
                ONE
            </p>
        </button>
        <button>
            <p>
                TWO
            </p>
        </button>
        <button>
            <p>
                THIRD
            </p>
        </button>
    </div>
</div>

Answer №1

To achieve a clean layout, you can enclose your content within a div.content element and utilize the clip-path: circle property.

However, it is important to note that the current compatibility for this approach is limited (https://caniuse.com/#feat=css-clip-path), so it's advisable to implement it cautiously based on your target audience.

#one{
      border:2px solid black;
      border-radius:50%;
      height:90px;
      width:90px;
}

.content {
  width: 100%;
  height: 100%;
  clip-path: circle(45px at 50% 41%);
}

    #unu{
      overflow:auto;
      position:absolute;
      top:20px;
      height:60px;
      width:80px;
      border:2px solid transparent;  
  
    }

    button {
      width:65px;
      height:40px;
    }
<div id="one">
  <div class="content">
       <hr style="width:60px;">
       <hr style="position:absolute; left:15px; top:74px; width:70px; " >
       <div id="unu">
          <button>
              <p>
                  ONE
              </p>
          </button>
          <button>
              <p>
                 TWO
              </p>
          </button>
          <button>
              <p>
                  THIRD
              </p>
          </button>
       </div>
       </div>
    </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

Is there a way to automatically generate and allocate an identifier to an input field?

I've written the code below, but I'm having trouble figuring out if it's accurate. Specifically, I can't seem to access the text inputs that have been created by their respective id attributes. for (i=0;i<t;i++) { div.innerHTML=div. ...

How can I enhance the appearance of my custom field using CSS in Advanced Custom Fields?

Utilizing the Wordpress Advanced custom field plugin, I have successfully added a custom field to my site. Within this custom field, I have inserted images and now I am looking to center them on my page using CSS styles such as margin: 0 auto. If you&apo ...

Thumbnails failing to line up in a continuous row

Having an issue creating a row with 3 thumbnails as they are not aligning in a single row, instead each thumbnail is going into a different row. echo "<table>"; echo "<tr>"; echo "</tr>"; while($r ...

Setting a const value (true or false) based on the size of the window - a step-by-step guide

While studying, I encountered a challenge: In the code below, I need to dynamically set useState(false) based on the screen size. If the screen is larger than 947px, for instance, it should automatically be changed to true. The issue arises because sett ...

Padding issue with Dropotron plugin not functioning properly

I'm struggling to reduce the right space on my drop-down menus. Here's what I've tried: .dropotron li { box-shadow: inset 0 1px 0 0 #e6e6e6; padding-right: 0 !important; } Unfortunately, it didn't work ...

Having trouble getting the drop down menu to function properly using HTML and CSS

I attempted to implement a drop-down menu using the following codes. However, I am facing some issues as clicking on the drop-down menu does not open the sub-menus as expected. Is there a way for me to resolve this problem? <div id="control-panel& ...

Tips for adjusting the content direction of a Popover

I am currently working on a component that includes the following code: import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Portal, Button, } from "@chakra-ui/react"; import { ReactNode } from "react"; import { Co ...

Issue with Error in Expanding Label in Material-Ui using React

I have managed to increase the size of the Label in the TextField component of my React application. However, I am encountering an issue where it overlaps some text on its right when it shrinks. https://i.sstatic.net/BikHJ.png Here is the link for refere ...

Creating an Online Store with Python and Django for Server-side Development

Looking to create a dynamic E-commerce platform with Bootstrap, HTML, CSS, and JavaScript for the frontend, along with Python, Django, and MongoDB for the backend. Can someone provide me with step-by-step guidance on crafting code files for each language a ...

Why is the 3D CSS transform (translateZ) feature malfunctioning on Android 4.0.3?

I have this HTML code that is functioning well on Chrome, Safari, and Mobile Safari. However, when testing it on Android 4.0.3, the translateZ property does not seem to have any desired effect on the div element. While everything else works as expected, ...

Align the number of an Unordered List to the left

Exploring UN-ordered lists in HTML has led me to wonder if it's possible for dynamically generated ul tags to display like this: * Hello * Hi * Bi * Name * Ron * Mat * Cloth * Color * Red When I ...

The rendering of the font appears distinct when viewed on an iPad compared to when displayed

Visit this website. The menu displays correctly on desktop, but on iPads, the font appears larger leading to a line break. Is it because the selected font isn't loading and defaulting to Times New Roman instead? It seems likely since I experience the ...

methods for transferring information from a website to a smartphone using SMS

I am currently in the early stages of learning JavaScript and working on a project that involves creating a form (a web page) to send data to my mobile device via SMS when the submit button is clicked. However, I am unsure how to transfer data from JavaS ...

Transforming CSS shorthand background properties into longhand representation

I have been working on a function to convert shorthand CSS background declarations into longhand. The function I created is functional, but it does not handle cases where the background-color property includes color values like black or yellow. It also doe ...

Text color wave effect - mimic a block of colors flowing through text

I'm experimenting with creating a unique text effect where, upon hovering over the text, it appears as though a block of color is passing through it. Inspired by the technique showcased in this first example (specifically for the word "Kukuri"), I ut ...

Guide for using two Async Pipe functions in Angular 7

Two different functions are in place to check a specific condition, and the requirement is for both of them to be true simultaneously. How can *ngIf be utilized to achieve this? Currently, setting just one of them works, but the aim is to have both. HTML ...

Discovering the positions of HTML elements rendered with WebKit (or Gecko) technology

I am seeking a way to retrieve the dimensions (coordinates) of all HTML elements on a webpage as they appear in a browser, including their rendered positions. Specifically, I need to obtain values like (top-left, top-right, bottom-left, bottom-right) Afte ...

Sending arrays from HTML table rows to a JavaScript function

When developing a dynamic table using Javascript, I am able to add rows programmatically with the following function: function addrow(tableid) { var tablename = document.getElementById(tableid); var rows = tablename.rows.length; if (rows < ...

Setting up only two input fields side by side in an Angular Form

I'm fairly new to Angular development and currently working on creating a registration form. I need the form to have two columns in a row, with fields like Firstname and Lastname in one row, followed by Phone, Email, Password, and Confirm Password in ...

Modifying JavaScript Code in Inspect Element Editor

When I modify the HTML content using Chrome's Inspect Element editor, any changes made are immediately visible. However, when I make changes to the JavaScript code, the modifications do not take effect. For example, if I have a button that triggers a ...