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

Transform the look of an inactive hyperlink

Can the visual style of an HTML link be modified when it is disabled? For instance, by implementing something like this: a.disabled { color:#050; } <a class="disabled" disabled="disabled" href="#">Testing</a> The code snippet above appears ...

Align text in a vertical manner within various containers

I'm encountering a puzzling issue with my side-by-side divs. I have different-size headers in each div, and I want the top header in each to be baseline aligned. Unfortunately, using vertical-align: baseline doesn't seem to work between the two d ...

Adjust the height seamlessly on the homepage without the need for scrolling, while maintaining a stationary navigation bar and footer

Our latest project is designed specifically for mobile use. The fixed navigation bar is functioning perfectly. We also have a fixed footer with icons at the bottom. (All working well) The challenge we are facing is to make the content between the naviga ...

Can the functions passed into Material-UI withStyles() be relocated within the component?

Attempting to break down the components of my dashboard into smaller parts has proven challenging due to their dependence on drawerWidth. Initially, I considered moving drawerWidth into the state so it can be passed down to each component. However, I encou ...

switch out asterisk on innerhtml using javascript

Is there a way to replace the asterisks with a blank ("") in the innerHTML using JavaScript? I've attempted this method: document.getElementById("lab").innerHTML = document.getElementById("lab").innerHTML.replace(/&#42;/g, ''); I also ...

How can I change the transparency of a CSS background color using JavaScript?

I have a question about CSS: .class1 { background: #fff } Now, I need to achieve the following: .class2 { background: rgba(255,0,0,0.5) }; Is there a way to use JavaScript only to change the background property of .class1 and give it an opacity of 0.5? ...

How to modify the color of a div element with jQuery?

I need some help changing the color of a div with 'jQuery', but I am not sure how to do it. Below is the code I have been trying: function updateDivColor() { $('#OutlineX1').css("color","blue"); } ...

Creating a sleek CSS drop-down navigation menu

I seem to be facing an issue with the side navigation drop down menu. Below are the link and CSS code: <nav id="nav"> <div class="menu-main_nav-container"><ul id="menu-main_nav" class="menu"><li id="menu-item-270" class="menu-it ...

Retrieving selected option value in React

I am currently using Material UI for my React application and I am encountering an issue with getting the value of a select form. Initially, I had success with the following code snippet: <select name="role" value={props.role} onChange={props.handleIn ...

Error Message Design in ASP.NET

I am currently developing a website using .net, which is a new technology for me. Here is the snippet of code I am working with... <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ValidationGroup="V1" Display="Dynamic" ...

Is it possible to create a custom tag in HTML 4?

What is a custom tag in HTML (Kindly note that I am specifically talking about the differences from XHTML)? I need to include some additional text to meet StackOverflow's posting requirements. Thanks! ...

steps to receive an event within an AngularJS function

I'm encountering an issue with the event display in this code. <div class="div1" ng-click="displayinfo(event)"> sadfasf </div> $scope.displayinfo = function(event) { alert(event); } Does anyone have a solution for this problem? ...

various stunning galleries accessible from a single page of thumbnail images

I'm trying to create a unique gallery experience on my website. I have a set of 6 images, each featuring a different house. What I want is for each image, when clicked, to open up a fancybox gallery showcasing 4 more detailed photos of the same house. ...

Is it possible to deactivate the onclick event following a successful ajax request?

I am looking to disable the onclick event after a successful ajax request. <div class="report_button" id="report_button" title="Reportthis" style="width:65px;height:15px;" onclick="reported_text(user_id,lead_id);">Report</div> This is the div ...

Exploring the Canvas with Full Element Panning, Minimap Included

Currently, I am working on incorporating a mini map onto my canvas that mirrors what is displayed on the main canvas. The main canvas includes zoom and pan functions. I have created a rectangular shape for the minimap to display the content of the canvas. ...

The background image is not displaying properly within a <span> tag

I am attempting to show a smiley icon within a span tag that is nested inside a list item. Below is the code snippet: <p> It contains various tabs:{" "} <li> Home - Showcase and brief informati ...

Troubleshooting CSS Navigation Drop Issue Specific to Google Chrome. Seeking Feedback on Rails Tutorial Experience

I'm currently working my way through the amazing Rails Tutorial and have encountered a problem with the Navigation bar dropping down into the body of the page, but this issue only seems to occur in Chrome (I'm using Linux, Ubuntu 10.10). I'v ...

One limitation is that you cannot use JQuery to make multiple rows editable simultaneously

I have a unique challenge with implementing an edit button on each row of a dynamic Bootstrap table. I am attempting to toggle the button's icons and, depending on its current state, enable the corresponding row for editing. <td><button typ ...

Automatic Addition of Row Numbers Enabled

I'm currently exploring coding and experimenting with creating a scorekeeper for family games. I've managed to add rows dynamically and automatically sum up the entered information in the "total" row at the bottom. However, I'm facing an iss ...

Customizing background size for iOS devices

This morning, I delved into research on a particular issue. Currently, I am crafting a single-page website that heavily relies on images. While Safari is usually criticized for its quirky handling of background-attachment:fixed, it seems to be working fine ...