What are the steps to creating this in HTML and CSS?


The design looks great on Android devices, but on desktop, the hr tag expands out of the circle and moves towards the top of the circle

#circle {
  border        : 5px solid red;
  width         : 40%;
  box-shadow    : 0 0 20px red, inset 0 0 20px red;
  aspect-ratio  : 1/1;
  border-radius : 50%;
  text-align    : center;
  font-size     : large;
  }
#circle > div {
  font-size   : 24px; 
  color       : white; 
  text-shadow : 0 0 10px #0fa;
  }
#circle > hr {
  background  : red; 
  border      : 2px solid red; 
  box-shadow  : 0 0 20px red, inset 0 0 20px red;
  }
#circle > span {
  color       : white; 
  text-shadow : 0 0 10px #0fa;
  }
<div class="circle" id="circle">
  <br>
  <div id="result1" ></div>
  <hr>
  <span id="result2"></span>
</div>

Answer №1

Get rid of both the <br> and <hr> elements. It may be necessary to adjust the stylesheet as well. Take a look at the suggested solution below:

#circle {
  border        : 5px solid red;
  width         : 40%;
  box-shadow    : 0 0 20px red, inset 0 0 20px red;
  aspect-ratio  : 1/1;
  border-radius : 50%;
  text-align    : center;
  font-size     : large;
  }
#circle > div {
  font-size   : 24px; 
  color       : white; 
  text-shadow : 0 0 10px #0fa;
  height: 50%;
  position: relative;
  }
#circle > div#result1 {
  border-bottom: 5px solid red;
  }
#circle > hr {
  background  : red; 
  border      : 2px solid red; 
  box-shadow  : 0 0 20px red, inset 0 0 20px red;
  }
#circle > span {
  color       : white; 
  text-shadow : 0 0 10px #0fa;
  }
<div class="circle" id="circle">
  <div id="result1" ></div>
  <span id="result2"></span>
</div>

Answer №2

To achieve the desired results on desktop, follow these steps (assuming you want a similar output to that of mobile and have a similar html structure).

Utilize the display:flex property to center items both vertically and horizontally using align-items and justify-content. Then, apply flex-direction:column to stack the items upon each other. Setting the <hr/> to width:100% will give you the desired result.

#circle {
  border        : 5px solid red;
  width         : 40%;
  box-shadow    : 0 0 20px red, inset 0 0 20px red;
  aspect-ratio  : 1/1;
  border-radius : 50%;
  text-align    : center;
  font-size     : large;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  }
#circle > div {
  font-size   : 24px; 
  color       : black; 
  text-shadow : 0 0 10px #0fa;
  }
#circle > hr {
  background  : red; 
  border      : 2px solid red; 
  box-shadow  : 0 0 20px red, inset 0 0 20px red;
  width: 100%;
  }
#circle > span {
  color       : black; 
  text-shadow : 0 0 10px #0fa;
  }
<div class="circle" id="circle">
    <br>
    <div id="result1">
        <span>8 days</span>
    </div>
    <hr>
    <div id="result2">
        <span>2:43:58</span>
    </span>
</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

Unable to get font-face to function properly on IE versions 7 and 8

I'm having trouble getting the font-face to work properly on both IE7 and IE8. This is the code snippet I have used: @font-face { font-family: 'DroidSans'; src: url('fonts/DroidSans.eot'); src: url('fonts/DroidSa ...

Tips for altering the color of the email text as it is being typed into the input field

Is it possible to customize the text color while typing email in an input field? <form action=""> <input type="email" name="mail" id="" placeholder="Your Email"& ...

Guide to effortlessly convert SCSS to CSS using an automatic vendor prefixer

Is there a tool that can convert SCSS to CSS while automatically adding vendor prefixes? I've tried using node-sass with npm, which worked well, but it doesn't add prefixes like box-sing: border-box; or display: flex; properties. Note: I also tr ...

Creating a centered floating card within a div that shrinks to fit its contents: A CSS how-to guide

I am facing a challenge with positioning a floating card that needs to be centered over the parent div (which happens to be selectable because it's a map). So far, I have only managed to achieve this by setting a fixed width for the card using the fo ...

The fluid table within the Bootstrap container is not adapting to different screen

Can't figure out why the bootstrap container fluid table is not responsive. Even though I used an example of My First Bootstrap Page that works fine and is responsive, this particular table remains unresponsive. I want to avoid using a scroll but will ...

Share the hyperlink to a webpage with someone else

In my SQL command, I have a unique feature that retrieves the complete URL value of the current page: [##cms.request.rawurl##]. This code returns the entire URL. I need to send this address to another page and load it into a special div called "load-fac". ...

What is the best way to choose the element directly beneath a specific element using jQuery?

I am facing a challenge where I need to manipulate HTML content using only jQuery, without changing the original structure. The requirement is to display and slide down content with a specific class (current) upon clicking on an h1 tag. However, I am strug ...

Using JavaScript to invoke Applescript commands

Is it feasible to execute Applescript from JavaScript? I would be grateful if someone could offer a sample code or useful reference link. ...

Can you customize the "rem" values for individual Web Components when using Angular 2's ViewEncapsulation.Native feature?

I'm interested in creating a component with ViewEncapsulation.Native that utilizes Bootstrap 4 while others are using Bootstrap 3. Below is the component code with Bootstrap 4: import { Component, ViewEncapsulation } from '@angular/core'; i ...

Moving objects from one container to another and organizing them

I have multiple small divs (referred to as "inner-div") and several container divs. My goal is to be able to drag the inner-divs to different container-divs and have them automatically rearrange within the new container. I have already set up the divs an ...

Is it possible to utilize window.location.replace function within an iframe?

Is it possible to use window.location.replace to bypass history and target on-page anchors without page reloads, but encounter issues when working within iframes? The main problem seems to be a CSP (content security policy) violation for script-src ' ...

Create a layout with three columns, each containing four list items

My unordered list (ul) has 4 li's and I'm trying to create 3 columns. However, when I have 4 li's, it only displays as 2 columns. How can I achieve a layout with 3 columns and 4 li's? Additionally, I want the li elements to be arranged ...

Clicking on a checkbox and subsequently removing validation through jquery

Situation : When the 'I am Fresher' checkbox is selected, I want to hide the 'Experience field', but still keep its validation visible so that my form cannot be submitted. My Requirement : When the 'I am fresher' checkbox is ...

Should the potential benefits of implementing Responsive Design in IE8 be taken into account in 2013?

It seems that there are still questions lingering about how to make responsive design compatible with outdated browsers like IE8 or even the dreaded IE7. Personally, I question the need for implementing responsive design specifically for IE8, considering ...

Using Bootstrap 3 to implement various grid systems within a single website

For a current project I am working on, my goal is to fill the entire .container with 7 columns within my grid system. To achieve this, I plan on adjusting the Less variable (@grid-columns) before compiling a bootstrap.css file at http://getbootstrap.com/cu ...

ScriptManager is not accessible in the current ASP.Net Core Razor Page context

I'm facing an issue where I have a view (such as Index.cshtml) and a page model (like Index.cshtml.cs). In the view, there's a JavaScript function that I want to call from the OnPost() method in the page model. I tried using ScriptManager for thi ...

Issue with background image not covering entire div

I am experiencing an issue where the background image of a div element is not occupying the full image. I want to display images side by side with text underneath them. Below is the CSS code: .img-w { position: relative; background-size: cover; ba ...

Is it possible for the content of the HTML Select to vary from the options displayed in the 'drop-down' menu that the user chooses from?

When a user clicks on a dropdown menu, I want them to see the full state names in the options like this. <select name="address_region" id="address_region"> <option value=1>Alabama</option> <option value=2&g ...

pass the HTML output back to Python

I am currently working on a local website using Python to create a button that will open the door to my room from my phone through a Raspberry Pi. I have already created a Python program that successfully opens the door, but now I am trying to implement an ...

Should you choose a pre-built CSS framework or create your own from scratch?

Have you come across a framework that meets your project needs with just a few tweaks, or have you forged your own path along the way? What advice do you have for someone facing this decision and focusing on priorities like: Implementing a CSS reset Refi ...