The CSS classes from Bootstrap are failing to function properly despite my best efforts in

I have been experiencing issues with the row and col classes in Bootstrap.

<!DOCTYPE html>
<html lang="en>
<head>
<meta charset="utf-8>
<meta http-equiv="X-UA-Compatible" content="IE-edge>
<meta name="viewport" content="width-device-width,initial-scale=1>

<link href="assets/css/bootstrap.min.css" rel="stylesheet>
</head>
<body>
<div class="container>
<div class="row ">
 <div style="background: cyan" class="offset-md-2 col-md-8>
    <h1 style="color: red">Login</h1>
</div>
</div>
<form method="post" action="login>
    <div class="row" style="background: lightblue; height: 300px; width:500px;">

        <div class="col-md-12>
            <div class="col-md-4>Select Type:</div>
            <div class="col-md-8>
                <select name="user_type" ad="user_type>
                    <option value="0">Select Type</option>
                <option value="Admin" name="admin" id="admin">Admin</option>
                <option value="Teacher" name="teacher" id="teacher">Teacher</option>
                <option value="Parent" name="parent" id="parent">Parent</option>
                </select> </div>
        </div>
        <div class="col-md-12>
            <div class="col-md-4>User Name:</div>
            <div class="col-md-8><input type="text" name="user_name" id="user_name" maxlength="63> </div>
        </div>
        <div class="col-md-12>
            <div class="col-md-4>Password:</div>
            <div class="col-md-8><input type="password" name="password" id="password" </div>
        </div>
        <div class="col-md-5><input type="submit" class="btn btn-primary" name="submit> </div>
        <div class="col-md-offset-2 col-md-5><input type="reset" class="btn btn-danger" name="reset> </div>

    </div>

</form>
</div>
</body>
</html>

When I input text in the "Select Type" field, it displays in two rows along with the select option. I would like the text and input field to be in a single row instead of two. Can anyone offer a solution to this issue?

Answer №1

<!DOCTYPE html>
<html lang="en>
<head>
<meta charset="utf-8>
<meta http-equiv="X-UA-Compatible" content="IE-edge">
<meta name="viewport" content="width-device-width,initial-scale=1>

<link href="assets/css/bootstrap.min.css" rel="stylesheet>
</head>
<body>
<div class="container>
<div class="row ">
     <div style="background: cyan" class="offset-md-2 col-md-8>
        <h1 style="color: red>Login</h1>
    </div>
</div>
<form method="post" action="login>
    <div class="row" style="background: lightblue; height: 300px; width:500px;">

        <div class="col-md-12>
            <div style="float:left;"  class="col-md-4>Select Type:</div>
            <div class="col-md-8>
                <select name="user_type" ad="user_type>
                    <option value="0>Select Type</option>
                <option value="Admin" name="admin" id="admin>Admin</option>
                <option value="Teacher" name="teacher" id="teacher>Teacher</option>
                <option value="Parent" name="parent" id="parent>Parent</option>
                </select> </div>
        </div>
        <div class="col-md-12>
            <div style="float:left;" class="col-md-4>User Name:</div>
            <div class="col-md-8><input type="text" name="user_name" id="user_name" maxlength="63> </div>
        </div>
        <div class="col-md-12>
            <div style="float:left;" class="col-md-4>Password:</div>
            <div class="col-md-8><input type="password" name="password" id="password"</div>
        </div>
        <div  style="float:left;" class="col-md-5><input type="submit" class="btn btn-primary" name="submit> </div>
        <div class="col-md-offset-2 col-md-5><input type="reset" class="btn btn-danger" name="reset> </div>

    </div>

</form>
</div>
</body>
</html>

Answer №2

Streamline your life by organizing your content effectively, instead of dumping everything in a single div.

<!DOCTYPE html>
<html lang="en>
<head>
<meta charset="utf-8>
<meta http-equiv="X-UA-Compatible" content="IE-edge>
<meta name="viewport" content="width-device-width,initial-scale=1>

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"     rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous>


</head>
<body style="background-color: lightgray">
<div class="container">
<div class="row ">
 <div class="offset-md-2 col-md-8">
    <h1 style="color: #333">Login</h1>
</div>
</div>
<form method="post" action="login">
<div class="row">

        <div class="col-md-12">
            <h5 style="float: left;margin-left: 30px; ">Select Type:</h5>
            <select name="user_type" ad="user_type" style="float: left;     margin-left: 20px; margin-top:5px; ">
                <option value="0">Select Type</option>
            <option value="Admin" name="admin" id="admin">Admin</option>
            <option value="Teacher" name="teacher" id="teacher">Teacher</option>
            <option value="Parent" name="parent" id="parent">Parent</option>
            </select> 
        </div>
    </div>
    <div class="col-md-12">
        <div class="col-md-4">User Name:</div>
        <div class="col-md-8"><input type="text" name="user_name" id="user_name" maxlength="63"> </div>
    </div>
    <div class="col-md-12">
        <div class="col-md-4">Password:</div>
        <div class="col-md-8"><input type="password" name="password" id="password" </div>
    </div>
    <div class="col-md-5 m-2"><input type="submit" class="btn btn-primary" name="submit"> </div>
    <div class="col-md-offset-2 col-md-5 m-2"><input type="reset" class="btn btn-danger" name="reset"> </div>

</div>

</form>
</div>
</body>
</html>

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

Unveiling the Magic: Transforming Objects into HTML Attributes using AngularJS

I have been working on developing a highly dynamic ng directive that creates tables based on a given data array and configuration object. I am looking for a way to assign attributes dynamically based on an object within the scope. For example, if I have an ...

Eliminate entry upon checkbox completion from task schedule

Currently working on developing my own to-do list web application. I have set everything up except for one thing. I am trying to figure out how to remove a checkbox from the array when it is checked. Can someone please assist me in achieving this using DOM ...

I am wondering if it is possible to swap out an image when hovering over an icon link by only using CSS and HTML

I am working on a layout where an image is displayed in a col-8 next to 4 icons and a paragraph in a col-4. I want to keep the formatting consistent on this page. Specifically, I would like the image linked to the first icon to automatically display when t ...

What is the best way to target the shadow DOM host element specifically when it is the last child in the selection?

I want to style the shadow DOM host element as the last child. In this particular situation, they are currently all green. I would like them to be all red, with the exception of the final one. class MyCustomElement extends HTMLElement { constructor() ...

Exploring Vue.js: Leveraging v-bind for multiple classes in Vue.js applications

Can someone assist me in figuring out how to apply multiple options to v-bind:class? In my Uno game, I need to determine the text color of cards based on their color property stored as a list of objects like this: ([{ Color: green, Value: 6}]. Here is my ...

Determine the exact scroll position needed to reveal the element when scrolling in reverse

I'm looking for a way to make my div disappear when I scroll down and reappear immediately when I start scrolling back up. Currently, it only works when I reach a certain position instead of taking effect right away. I need assistance in calculating t ...

The text fields keep duplicating when the checkbox is unchecked

There are check boxes for Firstname, Lastname, and Email. Clicking on a checkbox should display the corresponding input type, and unchecking it should remove the input field. I am also attempting to retrieve the label of the selected checkbox without succ ...

Title size in css

<div class="products_list products_slider"> <ul> <li> <a id="ContentPlaceHolder1_rptCategoryProducts_hlProductImg_0" class="product_image" href="/Urun/Oyuncak/woodoy-100-parca-kovali-ahsap-oyuncak-bloklar/7078"> <div class="produ ...

Revamping HTML Label 'for' with JavaScript: Unveiling Effective Techniques

I'm facing an issue with changing the target of a label that is associated with a checkbox using JavaScript. Here's the code I have: <input type="checkbox" id="greatId" name="greatId"> <label id="checkLabel" for="greatId">Check Box&l ...

The default padding and margin in Bootstrap are making the images protrude beyond the edges of the container

I have an issue where my images are stretching into the padding or margin that bootstrap uses to separate columns. I want to maintain the column division but avoid having the images stretch. While I have managed to shrink the image using padding, the white ...

Differences in Print Layout Between Chrome and Firefox when Viewing a PHP Website

I have been working on creating a print command to print a specific div, and I have managed to successfully run the print command using default methods like CTRL + P and also with a button click. The Issue: However, I have encountered a problem where the ...

Utilizing consistent CSS styles across VueJS components

Currently tackling a VueJS 2 project and facing issues with scoped styling when cleaning up the code. My setup involves 3 components that share similarities, prompting me to utilize mixins for consolidating the code into one file. Each component makes use ...

Tips for adjusting the height of a jQuery UI widget control through CSS

I have implemented a jquery widget on my asp.net webforms and am trying to adjust the height of the select control from the default 22px to 33px. I noticed in Google developer that the height is originally set like this: The current height setting is loca ...

Displaying videos in full screen using HTML5

I am attempting to create a fullscreen webpage with a video using the following code: <video id="backgroundvideo" autoplay controls> <source src="{% path video, 'reference' %}" type="video/mp4"> </video> ...

Practical applications of flexible layouts in everyday life

I'm currently on the hunt for real-world examples of elastic layouts, specifically those based on using em's for widths. Surprisingly, I haven't been able to find much out there. If anyone knows of any examples, I would greatly appreciate it ...

Issue with displaying elements at intended layering order when parent element has fixed positioning

My web app features both upper and lower elements (div) with a position: fixed. Each element has child popups also with position: fixed. Even though I want to position the popup above its parent element, using z-index doesn't work due to inheritance ...

Exploring ways to repeatedly collapse rows using HTML, CSS, and JavaScript

GOAL: I want to freeze the header, freeze the first column, and be able to collapse rows multiple times. CURRENT PROGRESS: I have achieved freezing the header, first column, but can only collapse rows once. MY CODE SNIPPET: </head> <body> &l ...

Incorporating a variety of background images and colors into a navigation bar

Hey there, I could really use some assistance with a design challenge I'm facing. My goal is to have a navigation bar with two different background colors - most of the list items should have a red background, while one specific item needs to have a b ...

Optimal ffmpeg configurations for encoding videos into mp4 and ogg formats for seamless playback on HTML5 platforms

Despite the buzz surrounding it, the HTML5 video tag is facing a minor issue. To ensure cross-browser compatibility, multiple video formats - like mp4 and ogg - need to be included for its use. Unfortunately, I couldn't find optimal settings for each ...

Maintain the active menu open when navigating to a different page on the website

My website has a dropdown menu, but whenever I click on a submenu link, the new page opens and the menu closes. However, I want the active menu to remain open on the new page of the website! To demonstrate what I have tried in a simple way, I created an e ...