Troubleshooting problems with forms using Bootstrap and HTML

I could use some assistance with a problem I'm facing while trying to acquire new skills through learning.

I would like my picture and forms to resemble the one in this image: enter image description here

index.html

<div class="jumbotron">
<div class="row">

   <div class="col-md-6 col-sm-6">
    <img class="img-responsive" src="img/lqvopodravnenasnimka.jpg" alt="smiley face">
    </div>  <!--col-md-5-->


    <div class="col-md-6 col-sm-6">
    <h3>Send Request</h3>
        <p id="mainparagraph">Заповядайте в нашия нов хотел Grand Hotel Gergana. Ние Ви предлагаме отлични условия, където можете да прекарате своите ценни свободни дни.</p>
        <form name="myForm" action="#" onsubmit="return validateForm()" method="post">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group form-group-sm" style="margin-top:20px;">
                        <label for="firstname" class="control-label">Name</label> <!--name-->
                        <br>
                        <input type="text" class="form-control" id="firstname" style="width:100%;" name="fname">
                    </div><!-- form-group-->
                </div><!--col-md-5-->

                 <div class="col-md-6">
                    <div class="form-group form-group-sm" style="margin-top:20px;">
                        <label for="surname" class="control-label">Surname</label>  <!--surname -->
                        <br>
                        <input type="text" class="form-control" id="surname" style="width:100%;" name="sname">
                    </div><!-- form-group-->
                </div><!--col-md-5--> 
            </div><!--row-->

            <div class="row">
                <div class="col-md-12">
                    <div class="form-group form-group-sm" style="margin-top:20px;">
                        <label for="email" class="control-label">Email</label>
                        <br>
                        <input type="text" class="form-control" id="email" style="width:100%;" name="mail">
                    </div>
                </div>
            </div><!--row-->

            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group form-group-sm" style="margin-top:20px;">
                        <label for="phone" class="control-label">Mobile phone</label>
                        <!--<span class="glyphicon glyphicon-arrow-right"><p style="color:gray; font-style:italic; font-size:0.7em;">Sample: +352XXXXXXXXX</p> -->
                        <br>
                        <input type="phone" class="form-control" id="phone" style="width:100%;" name="mphone">
                    </div>
                </div>
            </div><!--row-->

            <div class="row">
                <div class="col-md-6">
                    <div class="form-group form-group-sm" style="margin-top:20px;">
                        <label for="date" class="control-label">Date of birth</label>
                        <br>
                        <input type="number" class="form-control" id="number" Placeholder="DD" style="width:55px;" name="day">
                        <input type="number" class="form-control" id="number" Placeholder="MM" style="width:55px;" name="month">
                        <input type="number" class="form-control" id="number" Placeholder="YYYY" style="width:90px;" name="year">
                    </div>
                </div><!--col-md-6-->

                <div class="col-md-6">
                    <div class="form-group form-group-sm" >
                        <label for="text" class="control-label" style="margin-top:20px;">Nationality</label>
                        <br>
                        <select class="options" name="cars" style="width:100%;">
                            <option value="България">България</option>
                            <option value="Румъния">Румъния</option>
                            <option value="Гърция">Гърция</option>
                            <option value="Сърбия">Сърбия</option>
                        </select>

                    </div><!--form-group-->
                </div>

                <div class="col-md-12">
                    <input type="submit" value="SAMPLE BUTTON">
                </div>
            </div><!--row-->



        </form>
    </div><!--col-md-7-->

Answer №1

Fixing this issue is fairly straightforward. You were almost there! With Bootstrap, you need to include a container class on your main div to ensure everything is properly structured. In this case, it should be added to your jumbotron div.

<div class="jumbotron container">

This adjustment will neatly organize 90% of the content and make sure all columns work together seamlessly.

Regarding the input boxes, I noticed you were struggling with the date inputs. This is an easy fix as well. Simply insert the following code in your CSS:

#number {
   float: left;
}

By doing this, the input boxes will be positioned closely together just like in your image.

For a visual demonstration, you can check out this working example - https://codepen.io/anon/pen/MoqRMK

I trust that you have the necessary skills to implement any other modifications that may be needed.

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

Positioning elements absolutely within a Material-UI Grid component

Is there a way to align a Material-UI icon with text so that the lowest point of the icon starts exactly at the baseline? We are using Material-UI Grid layout. The issue we are facing is that if we align the icon using 'baseline', it appears too ...

Align the content vertically in a Bootstrap column that takes up the full height

Is there a way to make sure that the columns in a row are the full height of the row while keeping the text content vertically centered? <div class="row fixed-bottom mobile-navbar align-items-center"> <router-link to="/" cl ...

Is it possible to maintain the width of an element even when its height is set to 0px?

Let me provide a detailed explanation of my issue below, but the question remains the same: Is there a way to make an element hidden or invisible with a height of 0px or slightly more than 0px while maintaining its width for functionality in Safari? Here ...

Instructions for changing the background color continuously

One of my templates includes the following input: <div class="form-group" LayoutDirective=""> <label>Background color for views</label> <input type="text" name="background_color" id="background_color" ng-model="selectedLayout. ...

Seeking assistance in optimizing my Javascript code for more efficient canvas rendering

I've created a script for generating random moving lines as a background element for my portfolio. While it runs smoothly on its own, I encounter frame drops when combining it with other CSS animations and effects, especially at the beginning (althoug ...

Arranging Divs Inside a Container Div - Dealing with Overflow

I am in the process of developing a website that includes a unique structure that I have not encountered before. This layout involves joining multiple sections within a wrapper. As this is my first time attempting such a layout, I am encountering some chal ...

Incorporate a click function onto the image within the canvas

After creating a canvas and placing an image on it, I realized that I need to include a click event for that image. Below is the code snippet I have written in attempt to achieve this. <canvas id="myCanvas" width="578" height="1000"></canvas> ...

What is the process for opening a local HTML file in IE compatibility mode?

Having issues with IE compatibility mode while opening my HTML file on desktop. In IE8, unable to switch it to compatibility mode as the icon seems to disappear in local HTML documents. Any insights on this? LATEST UPDATE: Tried three solutions but still ...

How can I connect the playback speed of an HTML5 video element with Vue.js?

Is it possible to bind the playbackRate of an HTML5 video element without using getElementById in Vue.js? //Example of directly manipulating playbackRate with plain javascript var vid = document.getElementById("myVideo"); vid.playbackRate = 0.5; ...

Struggling with setting up a search bar for infinite scrolling content

After dedicating a significant amount of time to solving the puzzle of integrating infinite scroll with a search bar in Angular, I encountered an issue. I am currently using Angular 9 and ngx-infinite-scroll for achieving infinity scrolling functionality. ...

HTMLMediaElement does not have the setSinkId method

I am currently in the process of developing a WebRTC application using Angular, with the goal of managing audio output through the setSinkId() method within HTMLMediaElement. However, when attempting to use this method, I am encountering an error message s ...

Python Django: Implementing Proper Spacing in HTML Email Titles

We are currently working on integrating the email feature using Python Django, but we are encountering an issue with extra spaces appearing in the header of the emails as shown in these screenshots: https://i.sstatic.net/EpCca.png https://i.sstatic.net/q6 ...

Freemarker substitute & and &ampersand;

I am facing an issue with Freemarker. I need to eliminate all the special characters from this sentence as well as from similar sentences in the future: BLA BLA RANDOM &, RANDOM BLA In particular, I want to remove the & character. The platform ...

Stop jQuery popups from wrapping text when resizing the browser window

Whenever a link is clicked, a jQuery popup appears. The popup functions properly in terms of opening and closing, but I would like to ensure that its position remains fixed when resizing the browser window to avoid any wrapping issues. Typically, I use a ...

Using jQuery to move a div to a specific location on the page

Is there a way to translate the position of div x and y using Jquery that is compatible with all browsers, such as IE 7, IE8, IE9, and IE10? I have attempted the following: <div id="s1" style="-ms-transform:translate(159,430)"> hello ...

What's the best way to iterate through multiple objects within <td> tags using Vue.js?

I have an Array filled with multiple Objects, and now I am interested in iterating through each object as a <tr> within a <table>. I have successfully achieved this. However, some of these objects might contain nested objects. In such cases, I ...

Slider with a progress bar

Have you ever wondered if it's possible to create a progress bar using an input range? Imagine someone entering a number and the bar moves to the right, changing its background color on the left side of the thumb based on the size of the number. Check ...

Prevent scrolling on both md-sidenav and md-content in AngularJS Material

Currently, I am working on a website using AngularJs Material sidenav. My goal is to make both md-sidenav and md-content appear as one page, without any scroll bars showing up when the height of one element exceeds that of the other. How can I achieve th ...

Switching back and forth between JQuery and CSS display changes

My challenge involves utilizing a JQuery file to present one question at a time in a quiz format. Upon clicking the submit button, the intention is to progress to the subsequent question. However, I have encountered an issue where the transition occurs mom ...

Why is it that my JQuery sliders appear perfectly fine when viewed locally, but fail to show up when accessed on

I'm facing an issue with two JQuery sliders on my page. The local version works fine, but when I upload it to my web host, only one slider functions correctly. I need both of them to work as intended. Any insights on how to resolve this problem? See ...