Difficulty with alignment in the process of generating a vertical stepper using HTML and CSS

I'm currently working on developing a vertical stepper component using html & css with inspiration from this design. However, I've encountered some alignment issues in the css that I'm struggling to resolve.

CSS

.steps-container .step::before {
  display: inline-block;
  content: "";
  font-size: 10px;
  color: #fff;
  text-align: center;
  background-color: #e1e1e1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  position: relative;
  right: 4px;
  top: 2px;
}

.steps-container .step.active::before {
  background-color: green;
}

.step-vertical {
  border-left: 1px solid #e1e1e1;
  margin-bottom: 5px;
  margin-left: 5px;
}

HTML

<div>
      <div class="steps-container">
        <span class="step inactive">1</span>
        <div class="step-vertical">
          <div>
            <h5 class="text-grey">label text 1</h5>
            <button>Continue</button>
          </div>
        </div>
      </div>
      <div class="steps-container">
        <span class="step active">2</span>
        <div class="step-vertical">
          <div>
            <h5 class="text-grey">label text 2</h5>
            <button>Continue</button>
          </div>
        </div>
      </div>
    </div>

.

My desired output includes having the numbers 1 and 2 inside the circle and aligning the label text next to each circle. Any suggestions on how to achieve this would be greatly appreciated.

Answer №1

Here is the desired layout: applied the :before css to span and included display: inline-block; in .step-vertical to position it beside the span.

.steps-container .step {
      display: inline-block;
    content: "";
    font-size: 10px;
    color: #fff;
    text-align: center;
    background-color: #e1e1e1;
    /* width: 20px; */
    /* height: 20px; */
    border-radius: 50%;
    position: relative;
    right: 4px;
    top: 2px;
    padding: 5px 10px;
    color: black;
    vertical-align: top;
}

.steps-container .step.active::before {
  background-color: green;
}

.step-vertical {
  border-left: 1px solid #e1e1e1;
  margin-bottom: 5px;
  margin-left: 5px;
height:200px
}

h5{margin-top: 5px;
display: inline-block;}

button{
  display:block
}

.ml-2{
  margin-left:10px
}
<div>
<div class="steps-container">
      <span class="step inactive">1</span>
      <h5 class="text-grey">label text 1</h5>
      <div class="step-vertical"> 
         <div>
           <textarea class="ml-2" name="" id=""     cols="30" rows="10">           
           </textarea>
           <button class="ml-2">Continue</button>
        </div>
      </div>       
  </div>
   <div class="steps-container">
      <span class="step inactive">2</span>
      <h5 class="text-grey">label text 2</h5>
      <div class="step-vertical"> 
         <div>
           <textarea class="ml-2" name="" id="" cols="30" rows="10">            </textarea>
           <button class="ml-2">Continue</button>
        </div>
      </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

Choose a particular text node from the element that has been selected

Can anyone provide guidance on how to extract the text "Items Description" from the following HTML snippet using jQuery? <div class="items"> "Items Description" <ul> <li>1. One</li> <li>2. Two</li&g ...

The :before pseudo element doesn't seem to be functioning properly on Internet Explorer 11

The following code works well in Chrome and Mozilla, but unfortunately does not function correctly in IE11. I am attempting to apply a background color on hover to a div with the class .border-green, however this functionality is failing specifically in ...

PHP: Incorrect URL formats with or without a variable present

I am currently working on customizing a PHP web application and could use some assistance. The Application is originally set up to operate in the ROOT path of the Webserver. I have made some modifications to make it work in different paths, but I am facing ...

Using a border-radius on Internet Explorer 11 reveals the background through the corners

Encountering issues with rounded borders in IE 11 (11.0.9600.18350)? Check out this minimal fiddle for more information: https://jsfiddle.net/7phqrack/2/ Here's the HTML code snippet: <div class="backgrounddiv"> <div class="outer"> ...

"Create dynamic web pages with multilingual support using HTML, JQuery, and nested

For my multilingual website, I wrote this simple JQuery code: (function() { var language, translate; translate = function(jsdata) { $('[tkey]').each(function(index) { var strTr; strTr = jsdata[$(this).attr('tkey')] ...

Intrigued by the prospect of making HTML elements vanish or smoothly glide along with the content without obstructing it

I'm a beginner in coding and I want to make my website impressive. Right now, I have an HTML embedded element called "On this Page" that I would like to disappear when the user scrolls down the page. I've managed to position the element on the ...

Modifying Copyright Feature in Footer

I am attempting to implement this function within my dark-colored footer: import Typography from '@material-ui/core/Typography'; function Copyright() { return ( <Typography variant="body2" color="textSecondary" align="center"> ...

Display line numbers in HTML/CSS cellsorIncor

Attempting to include row numbers in HTML/CSS. Below is the HTML code with React populating the rows: <table className="table table-striped"> <thead> <tr> {/*<th>ID</th>*/} ...

Animate.css does not function properly when loaded locally

I'm currently using a Flask server to host an HTML file for testing purposes. Within the head of this HTML file, I have linked to a locally stored animate.min.css file (<link rel="stylesheet" type="text/css" href="{{ url_fo ...

Is it achievable to create shadows that do not overlap?

When you hover your mouse over the pill-shaped object, it should smoothly move over the circle as desired. However, the shadow of the circle still remains visible creating an unwanted effect. I am looking for a solution where the shadows do not overlap but ...

Extract the content of a textbox within an iframe located in the parent window

Is it possible to retrieve the value of a text box in an iframe from the parent page upon clicking a button? Below is an example code snippet showcasing the situation: <div> <iframe src="test.html" > <input type=text id="parent_text"> & ...

Create a React MUI component that allows menu items to become sticky when selected

Is there a way to make the mui MenuItem stay sticky to Select while scrolling down? To see the issue in action, check out this codesandbox example https://codesandbox.io/s/quirky-knuth-5hr2dg?file=/Demo.tsx Simply click on the select and start scrolling ...

What is the best way to disable the button hover effect after it has been clicked?

Many posts I've come across have similar issues to mine, but the suggested solutions are not working for me. I am struggling to remove the hover property of my button when it is clicked before triggering the removal event I have set up. Edit: Just t ...

What is the significance of the space between form.validate and .ng-invalid-email.ng-dirty?

I'm currently working on an AngularJS application and I'm confused about the spacing between "form.validate" and ".ng-invalid-email.ng-dirty" in the stylesheet code below: <style> form.validate .ng-invalid-required.ng-dirty {background ...

Showcasing a checkbox with the chosen item marked as selected

My goal is to allow users to select hobbies from a checklist provided. The chosen hobbies should then be added to the user table. I want the checkboxes to display the user's current hobbies - checked if selected, unchecked if not. Users should be able ...

Stylish CSS typography options for both Mac and Windows users

When browsing various websites, I've noticed that many of them showcase beautiful fonts without using images. Examples include The Firebug site and Happy Cog. It seems like web designers use CSS tricks and JavaScript to achieve this effect. I'm ...

Issue with Navigation Scrolling Feature on Wordpress

I am in the process of implementing a 'scroll-nav' for my website. To achieve this, I decided to separate the Navigation into two sections and incorporate some jQuery: <nav class="main-nav clearfix"> <?php wp_nav_menu(array('th ...

Tips for monitoring input content "live"

Currently, I am in the process of developing a web form that includes a text field intended to receive numeric values. If the user enters non-numeric characters into this field, the form will not submit. However, there is no error message displayed to noti ...

Unable to click on hyperlink and image not adjusting in size

I am having an issue with the anchor tags inside a div. For some reason, the width and height are set to 0px, and I have tried to adjust them with no success. Each dot in my onepage scroller is meant to navigate to a different page. .dotstyle-scaleup{ f ...

AInspector WCAG evaluation found that mat-select does not meet level A compliance standards

As I work on making my website WCAG level A compliant, I've encountered an issue with the mat-select component in Angular material. After running checks with the AInspector extension for Firefox, it appears that the mat-select component lacks aria-con ...