Tips for aligning images in the center of a div when they have a float left

My website, watersedgeofshelton.com, features a "floor plans" page with two images side by side using the float:left code. However, I am having trouble centering them on the page while still keeping them side by side.

Thank you!

div#floorplans {
text-align: center;
}
div#admiral {
float: left;
padding-right: 20px;
}
div#clipper {
float: left;
}    

Answer №1

To enhance the styling of your website, include the following CSS code snippet:

div#commander,
div#navigator {
    width: 50%;
}

Ensure to also delete the below code from your stylesheet -

div#commander {
    padding-right: 20px;
}

Answer №2

To start, eliminate the float property from both div#admiral and div#clipper. Next, navigate to div#floorplans and include the following code:

div#floorplans {
    text-align: center;
    display: flex;
    margin-left: 70px;
}

I trust this information proves useful for your task.

Answer №3

1) Eliminate Float
2) Opt for a table or ul li (with horizontal navigation and hidden bullets) to display images side by side.
3) Use "align-text:center"; if you prefer using div, then apply "margin:0 auto"

Trust this provides assistance :-)

Answer №4

Have you considered experimenting with something along these lines?

Consider placing the floating divs/images within a designated wrapper, assigning a width to the wrapper, and utilizing margin auto for the wrapper!

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

Expansive Offspring Division stretching to the Entire Vertical Length of its Guardian Division

I'm attempting to achieve full coverage of the parent div section by my child div section. Take a look at the Example URL (specifically where the Canadian Flag Stand Up Paddle Boarders are located) towards the bottom: Essentially, when I set the widt ...

Updating an image by replacing a rectangle at a specific location using HTML

I successfully implemented an interactive image on my webpage. When a specific area of the image is clicked, defined by Xmin < MouseLocation.x < Xmax and Ymin < MouseLocation.y < Ymax, I would like to replace only that area with a smaller image ...

Change the background color of a Bootstrap dropdown when toggled

I recently created this code snippet: <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle buttonForProfile" type="button" id="dropdownMenuButton" data-bs-toggle='dropdo ...

Need to update various form fields at once with jquery?

There is a form with fields for firstname, lastname, email, country, along with edit icon and submit/cancel buttons. When the user clicks on the edit icon in the top right corner, all values will be displayed in textboxes and the country will be shown in ...

Highlighting Selected Nodes in Drupal Views

Seeking Help with Drupal: Is there a way to utilize Views to highlight the current selected node? For example: I have a list of articles under a heading: 2009 Articles Dog Training Cat Cleaning Snake Wrangling The 3 articles are displayed in a view ...

Identifying the pressing of the enter key in an input field

Currently, I am developing an innovative IFrame browser that features an omnibox (identified as "address") and a "GO" button (identified as "submit"). One of the key challenges I'm facing is detecting when the user inputs information and hits the Ente ...

I'm receiving the error message "Fatal error: Call to a member function query() on a non-object," what could be causing this issue?

Need help with fixing an error on my private server realmeye. The error message I'm receiving is: Fatal error: Call to a member function query() on a non-object in /home/noxus/public_html/realmeye/index.php on line 112 =========================== ...

Dynamic Product Showcase using Bootstrap Framework

Currently, I am working on creating a product listing section for a hypothetical e-learning website that I'm developing. The top image is intended for desktop viewing, while the bottom one is optimized for mobile users. https://i.sstatic.net/vq8R2.p ...

Encountering an issue with jQuery: [ts] Expecting an identifier for $('.carousel').each(function(){})

In the process of developing an Angular project for a Multi-Item Carousel Advance which shows 1 item at a time, I have encountered a compilation error when utilizing JQuery. Despite having proper installation of JQuery, the error arises in the code snippet ...

Positioning the navbar in the center with Bootstrap 4 using Flexbox

My goal is to achieve the following using the Bootstrap 4 Navbar: I am looking to center the nav-links/items in the middle of the viewport using flexbox or .mr-auto utilities. I prefer to avoid a CSS-based positioning approach as it may not be consistent ...

Is there a way for ResponsiveSlides to fade the pager without causing any disruption to the content below, all

I have been working with the Responsive Slides jQuery plugin and made some custom modifications. Everything is going smoothly, but I am facing an issue with getting the pager and next/prev controls to fade in when hovering over the container. Although I s ...

Experience the ultimate Safari/iOS responsive design for seamless browsing on all

I am experiencing an issue with my website. In my "toggle device" toolbar, I selected the responsive option for iPhone 7 Plus, Galaxy 8, and others. While my website looks good on some devices, it does not function as desired when opened on an iPhone (7+/ ...

Concealing inactive select choices on Internet Explorer versions greater than 11 with the help of AngularJS

I am having trouble hiding the disabled options in AngularJS specifically for IE. Check out this fiddle for a better idea: https://jsfiddle.net/s723gqo1/1/ While I have CSS code that works for hiding disabled options in Chrome/Firefox, it doesn't see ...

The process of updating a session using jQuery

Whenever a checkbox is selected, the session gets populated with an id. However, if another checkbox is selected afterwards, the session remains unchanged. This is my current code structure: <input type='checkbox' class='imei' id=&a ...

What is causing the .sr-only class to malfunction in Bootstrap 5?

Currently, I am working on creating a one-page form using Bootstrap 5: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge& ...

Having trouble displaying the items in my Bootstrap 4 navbar

My branding is visible in the navbar, but the menu items are not showing up. The Bootstrap 4 dependencies are correctly ordered (Bootstrap 4 CSS -> Jquery -> Popper -> Bootstrap JS). The meta viewpoint is referenced in the <head>. HTML: ...

How to style the currently active route link in Angular 2 using CSS

I want to add custom CSS styles to active router links: <a [routerLink]='link'>{{name}}</a> Here's what I attempted so far (Using the default router-link-active class): .router-link-active { color: #000; font-weight: bold; ...

Tips for grouping multiple images in HTML without using any CSS to create the illusion of a single image

I am currently working on a newsletter project for my non-profit organization and I am faced with the challenge of coding a new banner. Due to compatibility issues with email clients, I have decided to steer away from using an image map and instead chop up ...

Eliminate the text color from the navigation bar links

I have implemented a navigation bar using Bootstrap. I utilized .bg-danger to include a red background color. However, the links in the navbar are displaying blue instead of black as expected with the use of .navbar-light. How can I prevent the links from ...

Is it possible for me to designate variables as an array element?

<!doctype html> <html lang="en"> <head> <title>Favorite Foods</title> <meta charset="utf-8"> <script> var foodItem0 = prompt("Enter your favorite food"); var foodItem1 = prompt("Enter your second f ...