Combine two div elements within a container div with responsive functionality

I am currently working on creating a responsive form in asp.net. I need help combining two divs to make them responsive. Here is the output of my code for reference.

.container {
  padding-right: 15px;
  padding-left: 0px;
  margin-right: auto;
  margin-left: auto;
  overflow: hidden;
}
.txtBoxLeft {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  border: solid 1px #5250fb;
  float: left;
  width: auto;
  padding: 14px;
  font-size: 16px;
  background-color: #908fff;
  color: white;
}
.txtBoxRight {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  border: solid 1px #5250fb;
  float: left;
  font-size: 16px;
  padding: 14px;
  margin-right: 12px;
}
.txtBoxRight:focus {
  border: solid 1px #908fff;
  background-color: #f3f4ff;
}
.txtBoxRight-1 input[type="text"] {
  width: 70%;
  margin-bottom: 12px;
}
.txtBoxRight-7 input[type="text"] {
  width: 30%;
  margin-bottom: 12px;
}
<div class="container">
  <div class="txtBoxLeft">CNIC #</div>
  <div class="txtBoxRight-1">
    <asp:TextBox ID="txtCNIC" CssClass="txtBoxRight" runat="server"></asp:TextBox>
  </div>
</div>
<div class="container">
  <div class="txtBoxLeft">Drop 1-ID</div>
  <div class="txtBoxRight-7">
    <asp:TextBox ID="txtDrop1ID" Class="txtBoxRight" runat="server" ToolTip="ID"></asp:TextBox>
  </div>
</div>

I have provided the code and output details above. Appreciate any assistance. Thank you!

Answer №1

To make a responsive design, set the container width to 100% and adjust the width of each control using a percentage as needed. For mobile responsiveness, add the following code:

@media (max-width:768px) { .myclass { Ensure all inputs expand to 100% } }

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

Having trouble retrieving the Current.User.Identity while using forms authentication

I am currently delving into the world of asp.net mvc 2 and am honing my skills by working on a test project. One issue I am encountering is with formsauthentication in logging into my website. I am successfully logging in, but I am not able to retrieve the ...

Tips for showcasing personalized validation alerts with jQuery in the HTML5 format?

One of the Javascript functions I designed is for validating file extensions before uploading: function validateFileExtension(field, extensions){ file_extension = field.val().split('.').pop().toLowerCase(); if ($.inArray(file_extension,exten ...

How to align all children at flex-start while positioning one child at the end?

I am currently working on a flex container that has 3 children. My goal is to have all the children align at flex-start, with the final child positioned at the bottom of the container. Can align-content be combined with align-self to achieve this layout? ...

Button Fails to Respond on Second Click

I have a button that triggers a JavaScript function. This function, in turn, initiates two sequential AJAX calls. Upon completion of the first call, it performs some additional tasks before proceeding to the second AJAX call. The button functions correctl ...

How to obtain the height of the parent screen using an iframe

Imagine a scenario where a div contains an image that is set to perfectly fit the height of the screen. This setup works flawlessly, with one exception - when placed within an iframe, the height of the div adjusts to match the content's height rather ...

Integration of ASP.NET Core Razor Pages with Identity Server

Working on an ASP.NET Core 3.1 project with Razor pages, I encountered a hurdle while trying to integrate Identity Server 4 into my simple application. Normally, in my other .NET Core projects, I would add the necessary configurations in the Startup.cs fil ...

Is there a way to disable the calendar linking feature in the iPhone Mail Client

I am currently working on an application where I generate emails with time stamps. However, when viewing these emails in the iPhone mail client, the timestamp gets turned into a link with an ugly blue color and underline. Is there a way to prevent this fro ...

Generating random objects in a straight line with Javascript and HTML5: A step-by-step guide

In my current project, I am developing a game using Javascript/HTML5 (within a canvas element) that features two distinct types of objects (referred to as object type A and object type B) falling from the top of the canvas. The goal for players is to swip ...

The cropper fails to load within the image element inside a modal pop-up

Utilizing fengyuanchen's cropper library, I am cropping an uploaded image and then submitting it to a form. <div id="change-dp" uk-modal> <div class="uk-modal-dialog uk-modal-body"> <button class="uk ...

What is the best approach to display a fluctuating price depending on specific options chosen in Next.js?

When working with 2 different select tags and rendering images based on the selection, I also want to display a price determined by the options chosen. For instance, selecting "Your Current Division" as Iron and "Your Desire League" as Bronze/Silver/Gold s ...

Executing a Javascript function on the server side with ASP.NET

I have a Textbox within a GridView. I am trying to update the Label.Text when the text in the Textbox is changed. However, I am facing an issue with calling a JavaScript function written in the .cs code behind file. Can anyone spot any mistake in the TbUni ...

Customizing element borders based on device size using bootstrap

I'm currently working with Bootstrap to design a mobile-first responsive layout. I have set up multiple rows and columns that I adjust based on different screen size categories. Is there a way to style borders using just Bootstrap classes for the var ...

Display the vertical scroll bar of the page when the mouse hovers over it

Struggling to reveal the main page scrollbar upon hover? While working on my portfolio, I hid the page scrollbar. Trying to display the scrollbar when hovering over the main container. Below is a link to my portfolio page and corresponding code. Any assis ...

The ul element is not being properly styled by the CSS pseudoclass :checked

I recently attempted to create a responsive navigation bar using a YouTube tutorial that utilizes a checkbox to display and hide the menu on smaller screens. Despite meticulously following the tutorial and testing different browsers such as Chrome, Edge, a ...

The element generated by a function triggered by $(document).ready is not being displayed

Within the example I have assembled, my objectives are as follows: To utilize a jQuery POST method inside $(document).ready to retrieve a "ticket" for future use Upon successful completion of the post request, call another function ("AddTicketAndRender() ...

What is the most effective way to add HTML from a dynamically loaded document using AJAX?

I am attempting to attach the information from a .html file to the body of my main webpage. Essentially, I am striving to create a reusable section of html that can be loaded into any page with a basic JavaScript function. Below is the content of my navig ...

Loading and refreshing iframe content in real-time using JQuery on change() and keyup() events

I have been tackling a unique challenge with my custom CMS in Drupal for a couple of weeks now. I am facing an issue where I need to dynamically load a URL by extracting the node ID from the target Drupal page and appending it to the base URL of the websit ...

How do I get rid of the form border and shadow on my WordPress login page?

Currently revamping the appearance of the Wordpress login page and most aspects are coming together smoothly. I opted to utilize a separate css file for this project, which has been effective overall. However, one issue persists. I've encountered diff ...

Using VB.NET to retrieve SQL query results and display them in an ASP.NET table

When you have retrieved SQL data results using an ExecuteReader() command in VB.Net, what is the most effective way to present this information in a table on a webpage? After some experimentation, I have found several methods to display the results, but I ...

Iterate through an array and update the innerHTML content for each value contained in the array

Looking to replace a specific word that keeps appearing on my website, I experimented with various functions and stumbled upon this method that seems to work: document.getElementsByClassName("label")[0].innerHTML = document.getElementsByClassName ...