What is the best way to align labels and textboxes next to each other when resizing?

I am facing an issue with screen resizing. The code below appears fine on a full screen, but as soon as I resize the window even a tiny bit, it starts to look distorted and unattractive. I have gone through the Bootstrap 4 grid layout tutorial, but it is not helping me resolve this problem.

Currently, it only looks like this on a full screen: From: [ 01/01/2010 ] To: [ 12/18/2018]

The moment the screen is resized, it changes to this:

From: [ 01/01/2010 ] To:
[ 12/18/2018]

If the screen is resized to anything less than full screen, it should look like this and remain that way until the smallest screen size:

From: [ 01/01/2010 ]
To: [ 12/18/2018]

I understand that the grid system is based on large, medium, small, and extra small. However, to me, anything less than a full screen is considered medium or smaller.

<div class="row">
        <div class="col">
            <label for="fromUploadDate text-muted">From:</label>
        </div>
        <div class="col">
            <kendo-datepicker></kendo-datepicker>
        </div>
        <div class="col">
            <label for="toUploadDate text-muted">To:</label>
        </div>
        <div class="col">
            <kendo-datepicker></kendo-datepicker>
        </div>
    </div>

Answer №1

Looking for a way to improve the layout of your webpage? Check out this helpful resource on Bootstrap's grid system. By simply adjusting the col class with one of the options provided in the official Bootstrap documentation, you can easily divide your content into multiple lines with the help of clearfix. Here's an example to guide you:

<div class="row">
 <div class="col-2">
  <label for="fromUploadDate text-muted">From:</label>
 </div>
 <div class="col-2">
  <kendo-datepicker></kendo-datepicker>
 </div>
 <div class="clearfix"></div>
 <div class="col-2">
  <label for="toUploadDate text-muted">To:</label>
 </div>
 <div class="col-2">
  <kendo-datepicker></kendo-datepicker>
 </div>
</div>

Last Updated: 2018-12-20

<div class="container">
 <div class="row col-sm-7">
  <div class="col">
   <label for="fromUploadDate text-muted">From:</label>
  </div>
  <div class="col">
   <kendo-datepicker></kendo-datepicker>
  </div>
 </div>
 <div class="row col-sm-7">
  <div class="col">
   <label for="toUploadDate text-muted">To:</label>
  </div>
  <div class="col">
   <kendo-datepicker></kendo-datepicker>
  </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

Achieved anchoring an object to the top of the page while scrolling

Recently, I've been working on a piece of code to keep my div fixed at the top of the page while scrolling. However, it doesn't seem to be functioning as intended. Would anyone be able to point out where I might have gone wrong? The element in ...

Exploring Media Queries Using Chrome Dev Tools

After an extensive search, it seems that the issue may lie in the fact that what I am seeking does not actually exist. When updating websites, I find myself constantly tracking down media queries. Is there a method to display all media queries for a speci ...

Tips for activating multiple CSS animations when scrolling

I am currently working on a project that involves multiple CSS animations. However, I am facing an issue where these animations only occur once when the page initially loads. I would like them to trigger every time the user scrolls past them, regardless of ...

What is the best way to combine flex-direction and flex-wrap in one row?

I'm working with a React component that looks like this: <Card className='form-margin width card' zDepth='3'> <CardText> <strong>Test</strong><br /> This is some text </Card ...

CSS slider experiencing issues

I'm currently working on creating a custom CSS ticker by referencing various examples online. I've managed to develop something that functions well, but it seems to only cycle through the initial 4 list items. Once it reaches the 4th item, it loo ...

Navigation arrows for sliding`

Is there a way to add custom right/left arrows to the Ionic slider component? Demo: Check it out on Stackblitz Note: Make sure to refer to the home.html page for more details. https://i.sstatic.net/jQ62l.png .html <ion-slides [pager]="true" [slide ...

Comprehending the Syntax of the ExtJS Framework

I have recently inherited a project utilizing Sencha's ExtJS framework without any handover or documentation. As I navigate through the code, I find myself trying to decipher certain syntax and exploring resources tailored for newcomers to this specif ...

The hidden absolute positioned div disappears once the sticky navbar becomes fixed on the page

Whenever my navbar reaches the top of the screen, the links in the dropdown menu disappear. I followed tutorials and examples from w3schools to build my webpage. Specifically: howto: js_navbar_sticky howto: css_dropdown_navbar This code snippet exempli ...

Images are appearing misaligned in certain sections

I have been utilizing the freewall jQuery plugin for organizing images in my website. While the layout of my first section, located at , is functioning properly, I am encountering some issues with its height. The code snippet that I am currently using is a ...

Trouble with bootstrap 5 nested accordions: panels won't collapse as expected

I've structured my page content using nested bootstrap accordions within Bootstrap 5. The primary accordion is organized by continents, with each panel containing a secondary accordion for individual countries. While the main accordion functions cor ...

Enhancing your CircularProgressBar with dual variant colors using Material-UI

https://i.sstatic.net/0d35R.png Best practices for customizing MUI components with React ...

Adjust the existing percentage of a never-ending CSS animation

I am looking to create a simple slider from scratch. The sliding functionality is working perfectly in an infinite loop, but I want to add the option for users to skip to specific slides (e.g. using arrows). @keyframes slider-ani { 0% { left: 33.3%; } ...

Tips for executing a right slide animation in Jquery

I used a div class to create an arrow symbol >>. On click, I would like the list of items to slide in from left to right and pause for 20 seconds. When clicked again, it should slide back to the left and disappear. I attempted this using Jquery but ...

Newly designed Bootstrap 4 input field with search feature positioned off-center on smaller screens

I have successfully positioned an input text next to a button as shown below: While it displays perfectly on a regular computer screen, the alignment gets skewed when viewed on a phone device: This is the functional code I am using: <!-- Add Filer Fo ...

What is the best way to dynamically display CSS code from a PHP variable without needing to refresh the

I am working on a page that utilizes ajax and PHP for all functions. Within the tab content, users have the option to select colors using color pickers. Once a user saves their chosen colors, I store the new CSS code in the database. The CSS code is as ...

Show random images of different sizes by employing jquery

I am seeking a solution for my webpage which currently loads a random image from an array and centers it using negative margins in CSS. While this method works fine with images of the same size, I am looking to modify the code so that it can handle images ...

CSS - Implementing Below Element Validation Message in MVC 3

Hello everyone, Currently, I am looking for a way to show input validation messages below the element instead of beside it. The default CSS file adds a margin-bottom of 19px to the <input /> element, so I need to adjust this positioning in order to ...

What methods do HTML document Rich Text Editors use to incorporate rich text formatting features?

I am curious about the way text in the textarea is styled in rich-text editors. I have attempted to style text in the form but it doesn't seem to change. How does JS recognize the characters typed by the user? Can you explain this process? Edit: Aft ...

CSS technique to display background on hover

My website has a bootstrap 'More' dropdown feature on the left navigation bar. However, there is an unwanted background hover effect that I can't seem to remove. Despite removing all background hovers from my CSS, the issue persists. Can any ...

Include parameters for a pagination system

I have a script that fetches data from my database and generates pagination. Everything is working fine, but now I want to include a conditional statement to differentiate the user level as New, Current, or Renewing client. I've already set up some s ...