Guide on creating concentric circle nested diagram with HTML and CSS

I created the illustration, but I'm unsure how to insert text into it.

I'd like to place the text inside the circular shape.

.shapeborder {
  border: 1px solid black;
}

.circle {
  border-radius: 50%;
}

.outer {
  background-color: blue;
  width: 400px;
  /* You can define it by % also */
  height: 400px;
  /* You can define it by % also */
  position: relative;
  border: 1px solid black;
  border-radius: 50%;
}

.inner {
  background-color: yellow;
  top: 50%;
  left: 25%;
  /* of the container */
  width: 50%;
  /* of the container */
  height: 50%;
  /* of the container */
  position: relative;
  border: 1px solid black;
  border-radius: 50%;
}
<div class="outer circle shapeborder">
  <div class="inner circle shapeborder">
    <div class="inner circle shapeborder"></div>
  </div>
</div>

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

Answer №1

If you're looking to achieve a similar effect, consider using the following JsFiddle Example

The concept involves encapsulating the text within a span element nested inside each div.

<div class="outer circle shapeborder">
  <span>Release planning</span>
  <div class="inner circle shapeborder">
    <span>Iteration planning</span>
      <div class="inner circle shapeborder">
        <span>Daily planning</span>
      </div>
    </div>
</div>

Each span element will be styled with position:absolute;, while its parent div will have position:relative;.

This allows for easy positioning of the text content.

div {
  position: relative;
}
span {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
}
span:last-child {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.shapeborder {
  border: 1px solid black;
}

.circle {
  border-radius: 50%;
}

.outer {
  background-color: blue;
  width: 400px;
  /* You can define it by % also */
  height: 400px;
  /* You can define it by % also */
  position: relative;
  border: 1px solid black;
  border-radius: 50%;
}

.inner {
  background-color: yellow;
  top: 50%;
  left: 25%;
  /* of the container */
  width: 50%;
  /* of the container */
  height: 50%;
  /* of the container */
  position: relative;
  border: 1px solid black;
  border-radius: 50%;
}

div {
  position: relative;
}

span {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
}

span:last-child {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
<div class="outer circle shapeborder">
  <span>Release planning</span>
  <div class="inner circle shapeborder">
    <span>Iteration planning</span>
    <div class="inner circle shapeborder">
      <span>Daily planning</span>
    </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

Using JavaScript, display JSON data retrieved from a PHP file

Currently, I am in the process of developing a web application that displays tweets based on a city inputted by the user through an HTML form. The city value is stored in the $_SESSION['city'] variable after the form is submitted. Subsequently, ...

Vertical scroll through a list of columns with a stationary header, while allowing both the list and the header to

Check out this JSFiddle example: https://jsfiddle.net/jefftg/1chmyppm/ The layout currently has orange header columns and white list rows that scroll together horizontally. However, the goal is to have the white list rows scroll vertically while keeping t ...

Display a modal pop-up containing HTML content

I recently started building a small website using Zurb Foundation. I have created a basic grid layout with large metro style div thumbnails (about 10 on the page). Now, I want to enhance user interaction by implementing modal windows that appear when a th ...

When working with AngularJS routing, utilize a function for the templateUrl to dynamically load the appropriate template

Can a function be used as the templateUrl in angularjs routing? The $routeProvider official documentation states: templateUrl – {string=|function()=} Check out the $routeProvider official documentation here In javascript, a function is typically def ...

When working with an array of objects in Vue.js, what is the optimal approach: replacing the entire array or modifying individual values?

I am currently utilizing Vue and Vuex to dynamically generate components from an array retrieved from SQLite using the library better-sqlite3. let table=[ { id:1, column_1:'data', column_2:'data', column_3:{'1&apo ...

Creating a Popup with a Hazy Background: A Step-by-Step Guide

I've been working on implementing a popup on my existing page that opens 4.5 seconds after the page loads. I want to add a blur effect to the background when the popup appears. I've tried various methods to add the blur effect to the main div, bu ...

The operation malfunctions if the variable input is below 50, causing it to produce inaccurate results

The function "calcFinalTotal()" was created to calculate the post-tax discount on a purchase of items that were previously totaled and stored in an input tag with the ID of "totaltaxamount". This function applies a 10% discount to orders between $50 to $ ...

The issue of CSS style and inline style not functioning properly in Outlook 2007

I created an HTML newsletter page that I need to send to a specific email address. However, when I view the email in Outlook, my styled HTML page does not display correctly. The CSS and inline styles work perfectly in the browser, so why do they not work ...

Is it possible to set client-certificate as optional with Node SSL (using rejectUnauthorized: true does not achieve this)?

I have been exploring how to enable two-way SSL authentication in Node.js, following up on a previous thread: Enabling 2-way (client-authenticated) SSL in node.js? Now that I have successfully implemented client-authentication/2-way SSL, the next step is ...

How to properly align list items using Bootstrap 4?

Trying to align content within two divs side by side in a container. The goal is to have the first div or ul content on the left and the second on the right. Attempted using text-left and text-right classes but no luck. <div class="header_full_width"& ...

Vue router adds hashes to paths automatically

I am currently developing a web application using Vue.js. I have implemented the vue.js webpack template and incorporated the fullpage.js framework with jQuery in my main.js file. The anchor feature of fullpage.js is utilized on my contactForm component to ...

How can I accurately determine the Content-length header when using node.js?

How accurate is my current approach to determining the content-length? What potential impacts are there when relying on string.length() for this calculation? And does specifying the charset as utf-8 have any significance in a node.js environment? payloa ...

Can React avoid re-rendering if the setState does not impact the rendering process?

For example, let's consider a scenario where a hook is used to make an API request: function useApi(...) { const [state, setState] = useState({ fetching: false }); useEffect(() => { setState({ fetching: true }); fetch(...) .then( ...

Having Trouble with jQuery Datepicker in IE8 - Need Unique Solutions

After visiting numerous websites, I am still unable to solve this issue. The error I am encountering (only in IE8, works fine in Chrome, FF, IE9 and IE10) occurs when using IE10 in the IE8 browser mode. Despite testing with IE8, the business department is ...

The code functions perfectly on the local server, but encounters issues on the hostinger hosting service - after dedicating 3 days to researching online and numerous unsuccessful attempts

[SCREEN SHOT ERROR 500 APPEARS EVEN AFTER FIXING THE PATH IN AJAX CODE] Uncertain if the issue lies in the ajax call or the path of resource files (jquery) HEADER, I ATTEMPTED TO USE MVC WHERE THE INDEX PAGE CONTAINS PATHS TO ALL PAGES, HEADER, FOOTER, CO ...

Converting Date Formats in ReactJS: A Guide for Manipulating Date Formats within an Array of Objects

I am working on a React application using Next.js, and I need to convert the date format within an array of objects using the moment library. The data structure looks like this: [ { "date": "2020-12-22T00:00:00.000Z", & ...

Building an HTTP request and response directly from an active socket in a Node.js environment

My current project involves passing HTTP requests to a child process in Node.js. I am struggling with passing the active Socket using child.send('socket', req.socket). Once inside the child process, I need to recreate the HTTP request and respons ...

JavaScript's method of organizing website loading sequences

I am currently facing a challenge with my web page that features a chart displaying a large amount of data using a 3rd party flash component. The issue arises when a significant portion of the data is lazy loaded and added to the chart via AJAX post initi ...

Unable to identify the pdf file using multer in node.js

const multer=require('multer'); var fileStorage = multer.diskStorage({ destination:(req,file,cb)=>{ if (file.mimetype === 'image/jpeg' || file.mimetype === 'image/jpg' || file.mimetype==='image/png') { ...

Is it possible to utilize Angular.js as a full substitute for a traditional JavaScript template engine?

While angular excels in two-way data binding and single-page applications, could it also serve as a viable replacement for a JavaScript template engine? Let's dive into the potential pros and cons of this approach. ...