the calendar icon is askew on the screen

Creating a calendar field for my validity field is on my to-do list.

https://i.sstatic.net/0JLHt.png

Here's the code I have so far:

<div class="col-12 col-12 col-md-4 col-lg-2">
    <div class="form-group">
        <label for="validity">Validaty</label>
            <input id="validity" name="validity" type="text" class="form-control"
                [(ngModel)]="order.validity"
                style="background-color: white; max-width: 300px;width: 100%;"
                placeholder="Validity" autofocus>
    </div>
</div>

I'm taking inspiration from these two fields:

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

And here's the corresponding code:

<div class="form-group row">
 <label for="picker2" class="col-12 col-sm-4 col-form-label">{{'startDate | t }}</label>
    <div class="col-12 col-sm-8">
       <div class="input-group" style="background-color: white; max-width: 300px;">
         <input id="picker2" class="form-control" placeholder="yyyy-mm-dd" name="dp2"
            ngbDatepicker #dp2="ngbDatepicker" [(ngModel)]="search.enddate">
               <div class="input-group-append" (click)="dp2.toggle()">
                     <div class="input-group-text">
                         <i class="icon-regular i-Calendar-4"></i>
                      </div>
                </div>
        </div>
    </div>
</div>

I attempted to tweak the code, but the icon ended up in the wrong position. Can someone help me figure out the issue?

<div class="col-12 col-12 col-md-4 col-lg-2">
    <div class="form-group">
        <label for="validity">{{'3735' | t}}</label>
         <input id="validity" name="validity"  class="form-control" placeholder="yyyy-mm-dd" name="dp2"
            ngbDatepicker #dp2="ngbDatepicker"
            [(ngModel)]="order.validity "
            style="background-color: white; max-width: 300px;width: 100%;"
            placeholder="Validity" autofocus>

            <div class="input-group-append" (click)="dp2.toggle()">
                 <div class="input-group-text">
                     <i class="icon-regular i-Calendar-4"></i>
                  </div>
            </div>
    </div>

https://i.sstatic.net/9zlf1.png

Answer №1

Take out the max-width: 300px;width: 100%; css from the input and relocate both the input and label within a

<div class="input-group">

Give it a shot to see if this fixes your problem.

<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" media="screen">
</head>
<body>
<div class="col-12 col-md-4 col-lg-2">
    <div class="form-group">
        <label for="validity">Stop</label>        
           <input id="validity" name="validity" type="text" class="form-control" style="background-color: white;" placeholder="STOP" autofocus>
        </div>            
    </div>
</div>
<div class="col-12 col-12 col-md-4 col-lg-2">
    <div class="form-group">
        <label for="validity">{{'3735' | t}}</label>
        <div  class="input-group">
         <input id="validity" name="validity"  class="form-control" placeholder="yyyy-mm-dd" name="dp2"
            ngbDatepicker #dp2="ngbDatepicker"
            [(ngModel)]="order.validity "
            style="background-color: white;"
            placeholder="Validity" autofocus>

            <div class="input-group-append" (click)="dp2.toggle()">
                 <div class="input-group-text">
                     <i class="icon-regular i-Calendar-4"></i>
                  </div>
            </div>
           </div>
    </div>
</body>

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

Arranging a Vertical Element Within a Rotated Holder

Who would have thought that geometry would come into play when working with CSS? I need help figuring out how to perfectly cover a rotated container with an upright background image. The goal is to hide the rotation on the sides and maintain dynamic contro ...

Transform the features of a website into a sleek iOS application using Swift

Can I take an HTML website coded with JavaScript and integrate its functionality into my app using WebKit or another method? By using WebKit or WebViews, I can load an entire webpage into my app, automatically bringing along its functionality. However, i ...

Unable to link JavaScript to HTML file through script tag

Upon testing out a responsive nav bar, I encountered an issue with the JavaScript not connecting. Despite placing the script tag at the bottom of the body as recommended, it still fails to function. index.html <html lang="en"> <head> ...

This video cannot be played on this platform due to its privacy settings

I'm facing a challenge with embedding my client's videos on our website. These videos have domain-level privacy settings, and I've been using the code provided by Vimeo. <div style="padding:28% 0 0 0;position:relative;"> ...

Iterate through an HTML table and transfer matching items along with their corresponding calculated amounts to a separate table

<html> <body> <div> <table border="1" id="topTable"> <thead> <th>Item</th> <th>Sold</th> </thead> <tbody id="topTableBody"> <tr> ...

Tips to ensure the div remains 100vh in height, even when empty

As I work on a simple webpage with a header, body, and footer, it's essential for me to ensure that the content takes up the entire height of the page using 100vh. However, if I only have plain text in the body section without any child tags, it ends ...

My React application is not showing the CSS styles as intended

In my project, I have a component file named xyx.js where I properly imported my scss file './xyz.scss'. Both of these files are in the same folder. Interestingly, when I view the styles using the Chrome scss extension, everything seems to be wor ...

Active bootstrap navigation tabs

I am struggling to maintain the active tab in my left navigation tab. The issue arises when I load the page with the first tab active, and then click on another tab - the new tab becomes active, but the first tab remains active as well. I would like only t ...

I need help figuring out how to databind HTML elements in my data table

I have a column in my data table that includes the value: <strong>Hello World</strong> What is the best way to bind this data to my GridView so that it displays as bold text instead of showing the word "strong"? ...

Obtain the numerical value of the vertical position of the mouse (

Currently, I am coding a JavaScript game and my objective is to designate a variable specifically for the Y axis of the mouse. I kindly request that the code be kept as simple and straightforward as possible, avoiding unnecessary complexity. That conclud ...

What is the best way to import my json information into an HTML table and customize the rows as radio buttons using only Javascript?

I am facing an issue with processing a JSON response: var jsondata = dojo.fromJson(response); There is also a string that I am working with: var jsonString = jsondata.items; The variable jsonString represents the JSON data in the file: jsonString="[ ...

The issue of CSS Grid not adapting fully to different screen sizes and

Recently, I took on a coding challenge from Frontend Mentor (this one) and managed to complete it successfully. However, the grid I designed is not fully responsive. It only adapts correctly when the page width matches the media query specifications. The c ...

What steps can be taken to obtain the fully computed HTML rather than the source HTML?

Is there a way to access the final computed HTML of a webpage that heavily relies on javascript to generate its content, rather than just the source HTML? For example, if a page contains script functions that dynamically generate HTML, viewing the page sou ...

Utilize Python and Selenium to post a comment on Instagram

Having some trouble with submitting comments on Instagram using Python and Selenium. The comment box on the Instagram web page has the following structure: <textarea aria-label="Añade un comentario..." placeholder="Añade un comentario..." class="Ypff ...

The height of the div element is causing issues for the adjacent item in the row

I am facing a styling issue where the height of my avatar image is affecting other inline items located next to it. The images below demonstrate this problem. https://i.sstatic.net/bovge.png https://i.sstatic.net/EsF2R.png As you can see, when I increas ...

Utilizing JQuery to populate DIVs with JSON information

Hey! I recently received some helpful advice from a coding expert, and now I'm in the process of restructuring my code based on these recommendations: When using $.each(), you have the option to return true or false. If you return false, the loop wi ...

There is a significant spacing issue between the header and main category when viewed on a mobile device

Experiencing issues with element distances on different screen sizes? While the website looks fine on normal screens, there's a noticeable gap between the header and main sections on mobile devices. See below for the provided HTML and CSS code. ...

Ways to modify styles defined in the global style.scss file using a child component's CSS and constraining it to affect only that specific component

When working on my Angular project, I have implemented some CSS styling in the global style.css file located at src/style.css. However, there are instances where I need to modify certain styles within a specific component only. Currently, I am able to achi ...

Update the color of the Navigation Div once it has moved past a certain div

I am trying to update the color of my navbar-toggle from white to black or black to white. The issue arises when it reaches a specific div with a class like 'white' or 'black'; the color changes as soon as the scroll starts. var stick ...

Implementing a sticky header for tables using Bootstrap

I'm experiencing a conflict because the header remains fixed only when I include the table-responsive class in my code. However, I also need the table to have overflow. Can anyone provide assistance with this issue? Using the table-responsive class ...