Show a collection of items surrounding an image in order to form a circular menu

For my website, I'm looking to implement a circular navbar that will surround the user avatar. Using ul and li elements, I have created various options that are necessary. Is there a way to position all the navItems around the bottom half of the avatar? The desired end result should resemble this:

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

This is how my .jsx file looks:

const Profile = () => {
 const { currentUser } = useContext(AuthContext);

 return (
   <div className="profile">
     <ul className="navMenu">
       <div className="avatarContainer">
         <img
           src="https://w7.pngwing.com/pngs/81/570/png-transparent-profile-logo-computer-icons-user-user-blue-heroes-logo-thumbnail.png"
           alt=""
           className="avatarPic"
         />
       </div>
       <li className="navItem">
         <EmailIcon className="navIcon" />
         <span className="navText">Email</span>
       </li>
       
      ... (remainder of the code)
      
     </ul>
   </div>
 );
};

export default Profile;

Here is my corresponding scss file:

.profile {
 @include themify($themes) {
   background-color: themed("bgSoft");
   text-align: center;
   height: 100%;

    ... (scss styling code)

 }
}

Currently, all my navItems are positioned to the left of the avatar, and I am unsure about how to move them around it. Additionally, I would like each navItem to appear sequentially as the page loads, requiring me to add animations for each one. However, I am uncertain about how to accomplish this.

Answer №1

In contemplating the challenge at hand, my mind conjured up several methods that could potentially address it:

  • Utilizing absolute positioning
  • Implementing either absolute positioning or grid layout with a touch of translate for precise placement
  • Crafting an intricate grid layout strategy and leveraging grid-area for accurate positioning

Fueled by my love for challenges, I proceeded to create functional prototypes that are ready for further refinement. (It dawned on me that the repetitive "Email" placeholder was merely for demonstration purposes, so I affixed numerical identifiers for clarity.)

Solution: Absolute Positioning

ul {
  position: relative;
  width: 200px;
  margin: auto;
  padding: 0;
}

li {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 95px;
  height: 95px;
  background-color: yellowgreen;
  border-radius: 50%;
}

li:nth-of-type(1) {
  width: 200px;
  height: 200px;
}
li:nth-of-type(2) {
  left: -115px;
  top: 90px;
}
li:nth-of-type(3) {
  left: -60px;
  top: 190px;
}
li:nth-of-type(4) {
  left: 50px;
  top: 225px;
}
li:nth-of-type(5) {
  left: 160px;
  top: 190px;
}
li:nth-of-type(6) {
  left: 220px;
  top: 90px;
}

Enhanced Approach: Absolute Positioning with Translate Technique

ul {
  position: relative;
  width: 200px;
  margin: auto;
  padding: 0;
}

li {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 95px;
  height: 95px;
  background-color: yellowgreen;
  border-radius: 50%;
}

li:nth-of-type(1) {
  width: 200px;
  height: 200px;
}
li:nth-of-type(2), li:nth-of-type(3), li:nth-of-type(4), li:nth-of-type(5), li:nth-of-type(6) {
  translate: coordinates; /* Fill in appropriate values */
}

Optimized Design: Grid Layout withTranslate Method

ul {
  display: grid;
  width: 200px;
  margin: auto;
  padding: 0;
}

li {
  grid-area: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 95px;
  height: 95px;
  background-color: yellowgreen;
  border-radius: 50%;
}

/* Define positioning for each list item using grid-template-areas */

Precision Engineering: Detailed Grid Layout System

ul {
  display: grid;
  grid-template-columns: repeat(18, 25px);
  grid-template-rows: repeat(13, 25px);
  width: 450px;
  margin: auto;
  padding: 0;
}

li {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 95px;
  height: 95px;
  background-color: yellowgreen;
  border-radius: 50%;
}

/* Fine-tune grid area placements for each list element accordingly */

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 display a secondary header once the page is scrolled down 60 pixels?

.nav-header2{ background: purple; display: flex; justify-content: center; align-items: center; } .header2-container{ width: 68vw; height: 60px; padding: 0 2vh; border: 1px solid red; ...

Sending values to URL using the <a> tag in HTML

I currently have the selected language stored in a variable (var lan= urlParam('language')). I am trying to pass this language as a parameter (without PHP) in a URL within an "a" tag, like so: <a href="http://hotelscombined.sitewish.gr/HotelN ...

Save mathematical equations written in HTML text boxes to a MySQL database

How can I display mathematical formulas in a text input and store them in a database? I need to be able to display formulas like the ones shown in the image at this link: Currently, when I copy any formula into the text box, it gets converted to normal t ...

Creating an interactive slideshow using jQuery and styling it with CSS

Upon downloading the script for a slider show, I encountered no issues. However, after implementing the slideshow, I faced problems with SEO optimization in HTML5. The code included <div u=""> or <img u="">, which resulted in an error message s ...

html - automatically populating input fields when the page loads

Currently, I have an HTML form embedded in the view and I am looking for a way to automatically populate specific input fields with json variables obtained from the server. Instead of manually writing JavaScript code for each field, my goal is to access th ...

Creating a centered div in HTML for WordPress

<div id="logo" style="center"><img src="logo1.png"></img></div><br><br><br><br><br><br><br></div> It seems like there is an issue with the styling of the div element. The syntax might ...

Tips on implementing reduce() in place of a traditional forEach loop in a ReactJs application

In my React app, I currently have the following code snippet: let numberOfAnswers = 0 let sumOfAnswers = 0 responses.forEach(function (element, index) { console.log(index + "-" + element["responses"]) numberOfAnswers += element["responses"] s ...

JavaScript: The initial function call does not correctly switch the "boolean" in Local Storage

I'm currently developing a project that involves implementing a tutorial overlay. My goal is to have the overlay toggle on and off using a button, while also ensuring that the state of the button is remembered between page transitions so that users do ...

Creating time input forms that are responsive can be achieved by leveraging the features of Bootstrap

Currently, I am working on a Laravel project and I am facing an issue with making a form responsive. I have added the following viewport meta tag, but I have not seen any changes. Any suggestions on how to make this form responsive would be greatly appreci ...

Randomly positioning an image while the page is loading

I've been developing a portfolio website to showcase my design work, but I've encountered a minor issue. My goal is to have the images load in random positions and then make them draggable using Dragabilly. However, sometimes all the images end ...

What is the best way to empty an array within the state of a React component using JSX?

I need assistance with a React and JSX project where I am creating input fields that can be removed by clicking a button. Currently, I have an empty array stored in the state of the Page component. This array is updated using the addItems function. Howev ...

The excessive height of a Bootstrap 5 row is causing the image to overflow beyond the container

I am currently working on setting a maximum height for a banner I am designing in bootstrap5. Here is my code snippet: .banner { background: red; max-height: 50px; } <head> <title>Example</title> <meta charset="utf-8" ...

I need help converting the "this week" button to a dropdown menu. Can someone assist me in troubleshooting what I am missing?

Seeking assistance with customizing the "this week" button on the free admin dashboard template provided by Bootstrap 4. Looking to turn it into a dropdown feature but unable to achieve success after two days of research and watching tutorials. See code sn ...

Is NPM causing an issue with starting REACT?

I attempted to initiate my React Project, but encountered the following error message: Could not locate a necessary file. Name: index.js Searched in: /Users/cabraces/Projects/cesarcabral/portflio/src npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ...

Ways to align grid components at the center in MUI frameworks?

I am brand new to using MUI and currently experimenting with the grid functionality. <Grid className={classes.grid} container spacing={{ xs: 2, md: 3 }} columns={{ xs: 4, sm: 8, md: 12 }}> {data.data.map((item, index) => { ...

Having a CSS position fixed within a div container with the same width as its parent container

At the moment, I have three sections: left, center, and right. I want to add a fixed position div (notification) inside the center section so that it remains in place when scrolling. Additionally, I want this notification to resize according to changes in ...

Struggling to connect HTML with CSS in Hugo

I am experimenting with a pre-fabricated theme in Hugo and incorporating some Bootstrap codes. I want to change the color of all links when displayed or hovered over. Despite searching extensively, I have been unable to achieve this through the use of CSS ...

Using PHP, eliminate all hyperlinks from the DOM HTML

I have a string called $processhtml that contains some HTML. My goal is to remove all link tags and their contents from the HTML using PHP. For example: "This is some text with <a href="#">link</a>" should become: "This is some text with" ...

Tips for adjusting the placement of enlarged images within colorbox

I recently discovered colorbox and decided to use it as my lightbox solution. However, I encountered a challenge with positioning the background (#cboxOverlay). I wanted to move it 120px to the left so that some content from the original page would still ...

Navigating the division between presentational and container components in React/Redux

Here is a basic outline of my current setup: container.js: import Presentation from './Presentation'; import { connect } from 'react-redux'; export default connect( ({ someState}) => ({ ...someState }), (dispatch) => { ...