Problem with datepicker interface not aligning properly with Bootstrap grid

I am encountering a challenge with aligning the input controls in my UI design. Specifically, I am trying to create rectangular borders/containers around each set of input controls and looking for a way to achieve this using Booststrap. For reference, you can view the code snippet and mock-up design here: https://i.sstatic.net/bM5sX.png.

In the provided image, the 'calendar icon' is not correctly positioned next to the 'Date' textbox, causing alignment issues with other controls. I also have a mock-up design available.

 
    <div class="container-fluid bg-3 text-center">
      <form>
        <div class="form-row">

            <div class=" form-group date col-md-2 ">
                <label for="DateFrom">Date From</label>

                <input type="text" class="form-control" id="DateFrom">
                <span class="form-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>

            </div>
            ... (remaining code snippets follow)

To address the alignment issue and achieve the desired layout with borders around the input controls, please refer to the mock-up design and expected output here: https://i.sstatic.net/oifXp.png. Kindly advise on how to adjust the alignment and position the 'calendar icon' correctly next to the date textbox while also getting borders around the input controls.

Answer №1

My primary focus will be on addressing the use of the 'calendar icon' in this response. To achieve this, you can utilize CSS to display the icon in the background and position the text accordingly:

#icon {
  height: 40px;
  margin-top: 10px;
  border: 1px solid #e6e6e6;
  padding-left: 40px;
  padding-right: 50px;
  background: #f5f5f5 url(http://i.imgur.com/5xD8KRw.png);
  background-repeat: no-repeat;
  background-position: left 10px center;
}
<input type="text" id="icon" value="input">

If Bootstrap is your preferred choice, I recommend using a <span> with the bootstrap class input-group-addon containing an <i> tag for the icon. Here's an example:

<form>
    <div class="input-group">
      <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
      <input id="email" type="text" class="form-control" name="email" placeholder="Email">
    </div>
</form>

You can adjust the column size in Bootstrap by altering the col-md- values to create different-sized columns within a row.

You can also create new lines using the HTML tag <br /> and align radio buttons using the class text-left.

<div class="container-fluid bg-3 text-center">
  <form>
        <div class="form-row">

            <div class=" form-group date col-md-3 ">
                <label for="DateFrom">Date From</label>

                <input type="text" class="form-control" id="DateFrom">
                <span class="form-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>

            </div>
            
            // More code snippets here...

        </form>
</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

Creating a dynamic tbody element on button click with the help of javascript or jquery

I am working with the following code: $(document).ready(function() { //Optimizing by selecting tbody first using jquery children var tbody = $('#myTable').children('tbody'); //If no tbody found, select the table itself ...

Utilize CSHTML Script to Show HTML Content When SQL Query Results in Null

I have a CSHTML Script that a friend has written, and I am currently making some changes to it. I have a SQL Query saved as a variable and if this query returns NULL, then I want to display different HTML compared to when it returns results. Below are the ...

What is the best way to ensure bidirectional text appears correctly when two conflicting languages are combined, ensuring explicit directionality is set?

As I work on localization implementation, I encounter an issue with the directionality of mixed characters on the page. The text content is stored in a json file and inserted into the DOM using a Vue.js template. While individual characters display corre ...

Is there a way to display shortened text only when hovering without altering the height of the list box?

Here is my script for a vue component : <template> ... <b-card-group deck v-for="row in formattedClubs"> <b-card v-for="club in row" img-src="http://placehold.it/130?text=No-image" img-alt="Img ...

What are some creative methods to apply CSS styling to material-table in React?

I've spent several days searching for a solution without any luck. My project involves using material-table in React, and I am struggling to apply CSS styles to the headers (columns) and content (such as changing font size, adjusting width, and creati ...

Include content within the navigation bar of Bootstrap 3.3

I am trying to insert text at the end of the header in a jumbotron template: <div id="navbar" class="navbar-collapse collapse"> <form class="navbar-form navbar-right"> <div class="form-group"> <input type="text ...

Using JavaScript, redirect to a specified URL once a valid password has been entered on an HTML form

Need help with JavaScript for password validation and URL redirection. I'm new to JS and used some resources like Password correct? then redirect & Adding an onclick function to go to url in javascript?. Here's my current code: ...

Utilizing Selenium for web scraping on Google Maps consumes an excessive amount of data

Scraping travel times from Google Maps is a task I have successfully accomplished. The code below scrapes travel times between 1 million random points in Tehran utilizing multiprocessing for efficiency. You can run the code provided in a terminal environme ...

The Feedback Form jQuery is not providing any data

I'm facing an issue with my html page that includes an ajax query to a php file. The purpose of this php file is to send a message and then return a response to the ajax query. However, no matter what I try, I am unable to receive any response from th ...

AngularJS combined with jVectorMap allows for the seamless rendering of small interactive

I am facing a similar issue to one discussed here, but with some minor differences. Initially, my map loaded without any problem on the site. However, after adding Angularjs to the site, I noticed a 'small' map issue. It seems like a simple code ...

resizing problem with images that adapt to different screen sizes

I've been working on creating a responsive website, but I'm having trouble with the resizing of the two background images I added to the header. When I view the site on a mobile device, the header appears squashed. I think this might be because I ...

What is the best way to identify the full URL along with the querystring?

While using a web application on Firefox, I encounter an issue where clicking on a button redirects me to a different page and processes query string parameters that are hidden in the URL. Can anyone suggest tools that can help me identify these query str ...

Adjusting the position of an iframe with a YouTube video when the window is resized

I'm struggling with resizing and moving a YouTube video embedded using the Youtube API. I'm not a web designer, so I'm facing some difficulties. When trying to resize the window, I can't seem to move or resize the video within an iframe ...

Looking to update properties for elements within the Angular Material 16 mat-menu across the board?

Currently working with Angular Material 16 and I have a question regarding the height of buttons inside the mat-menu element. Here is an example of the code: <button mat-icon-button> <mat-icon>more_vert</mat-icon> </button> ...

Ways to verify the efficiency of view engines such as Pug, EJS, and HTML

Currently, I am in the process of creating a Node.js Web Server. Initially, I decided to use pug as my view engine for this project. However, the Web Designer provided me with HTML files that have a very different syntax from pug. As a result, I am cons ...

Issue with implementing styles on Navbar React component

I'm currently learning Next.js, specifically working with version 10.0.3. In my project, I am using react-bootstrap version 1.4.0 and classnames version 2.2.6. Within my project, I have a component called Navbar that I am trying to style in a certain ...

Despite having a hover animation, the CSS animation remains stuck

I'm looking to create a hover animation where one picture disappears upon hovering and is replaced by another picture, but I'm having trouble getting the back picture to disappear My attempt involved changing opacity from 1 to 0 with a transitio ...

Boosting Your SCSS (SASS) Productivity

I'm curious if there are any ways to make the code below more efficient or dynamic. I've already achieved the desired result, but I'm interested in optimizing it further. The Script Any suggestions would be highly appreciated, Cheers, ...

Using array map to create a centered table in a React web application

In my React project, I created a table using the array.map function. However, I'm facing an issue where the output of array.map is always aligned to the left, even before the table itself. I want to center the entire table. JSX: <div className=&qu ...

Extracting Data from Web Pages

How can I efficiently extract data from a webpage with dynamic loading using AJAX? For instance, imagine a webpage that initially shows 20 images, but as the user scrolls down, more images are loaded (similar to Facebook). In this scenario, how would you ...