What might be causing Flex not to function properly on my personalized landing page?

I attempted to create a basic landing page featuring an image background with a logo, button, and a row of 4 images displayed side by side using Flex. However, for some reason, the Flex is not functioning properly for the row of images.

Here is the code snippet for my page:

body, html {
  height: 100%;
  margin: 0;
}

.bg {
  background-image: url("/img/gibson-bg.jpg");
  height: 100%; 
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
.heading {
  background: #000;
  height: 100px;
}
.button {
    color: white;
    border-radius: 50px;
    background-color: #1F4A5D;
    border: 2px solid white;
    display:block;
    padding: 20px 30px;
    text-decoration:none;
}
.interiors {
    display: flex;
    column-gap: 15px;
}
.interiors div {
    flex: 1 1 23%;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>

<div class="bg">
    <div class="heading">
        <img alt="gibson logo" src="https://placehold.co/2000x1600">
    </div>
    <div class="buttonContainer">
        <a href="https://www.choicehotels.com/montana/great-falls/ascend-hotels/mt123" target="_blank" class="button">BOOK A ROOM TODAY</a>
    </div>
    <div class="interiors">
        <div><img src="https://placehold.co/900x600"></div>
        <div><img src="https://placehold.co/900x600"></div>
        <div><img src="https://placehold.co/900x600"></div>
        <div><img src="https://placehold.co/900x600"></div>
    </div>
</div>
</body>
</html>

The provided code showcases my attempt with placeholders. Visit this link for the actual page.

Both versions demonstrate the issue where the row of photos appears larger than intended despite applying a flex value of 25% to each item in the grid.

This is the look I was aiming for: https://i.stack.imgur.com/L62tB.png

Answer №1

Ensure to adjust the width of the image tag accordingly.

.interiors div img {
  width: 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

In what way can a programmer create HTML tailored to a designer's needs, even without a comprehensive grasp of

Currently, I am diving into my most ambitious website project yet. It's worth mentioning that I'm utilizing ASP.NET MVC 2 and the Microsoft stack. I value design and aesthetics greatly, knowing they can make or break the success of this endeavor ...

Establish a new <section> to serve as a distinct webpage

I have a question about creating multiple <section> elements on a page. I am looking to build an HTML document with several <section> tags, as outlined below. <html> <head> </head> <body> <sectio ...

"Error message stating 'Unresolved variable' occurs in the code while trying to assign className={styles.nameOfClass

My current task involves adjusting the style of a button in ReactJS using the "className" property. However, I encountered an error message in WebStorm stating "Unresolved variable nameOfClass," and the desired style changes did not reflect when running we ...

Display the form-control field only when a selection has been made in the previous form-control using HTML and PHP

I'm in the process of developing a webpage with form controls (2 in this example). Here's my code: <body> <div class="option_choice_global"> Select your options <div class="col-xs-2"> <lab ...

Explore lengthy content within Angular 2 programming

I have a lengthy document consisting of 40000 words that I want to showcase in a visually appealing way, similar to HTML. I aim to include headers, paragraphs, and bold formatting for better readability. Currently, I am developing an Angular application. D ...

When clicking on an image, it triggers a unique PHP query, however the results obtained are not accurate

Greetings, I have a search feature on my website. When a user inputs a keyword and clicks the search button, it directs them to jobsearch.php which then displays a list of relevant jobs from the MySQL database. The functionality is working perfectly. Howe ...

Video background with alternate image for touchscreen devices

Check out this website! The background video is functional on desktops. On smaller screens, an image is shown instead using CSS display property. However, what should be done for touch screens like iPads, which are not exactly small? Here's the code ...

Switching between various quantities of inputs in each row using Bootstrap V3

My Bootstrap V3 form has a mix of rows with two inputs and rows with one input, as per the designer's request. Check out my fiddle here: https://jsfiddle.net/06qk4wh4/ <div class="form-group col-sm-12"> <label class="control-label col- ...

When attempting to execute a script that includes document.write, it will not function as expected

Our web program is utilizing ajax and jquery, specifically Netsuite. I've been attempting to adjust elements on a page using document.ready and window.load methods in order to load an external script onto the page. Regardless of whether I load this ex ...

use python selenium to retrieve text enclosed by two span elements

<li class="page-item active"> <span class="page-link"> "12" <span class="hjhs">(current)</span> </span> </li> After reviewing the code above, my objective is to extr ...

"Cascading Style Sheets for Organizing Buttons in a Grid

I have created a layout in Word that I want to achieve: https://i.stack.imgur.com/krK7w.png After researching, I found out about the CSS grid layout which seems like the best option for achieving the desired layout. However, when implementing the grid i ...

The position of a jQuery element gets reset when both the show and stop animations are used

When I use jQuery's .position() to place an element, everything works fine. But as soon as I display an animation and then cancel it with an ajax call, the position of the element resets. function displayMessage(msg) { var $messageEl = $('#u ...

Disable browser suggestions in Material UI's Autocomplete component

Encountering an issue with Material-ui Autocomplete: import Autocomplete from "@material-ui/lab/Autocomplete"; Currently using it in: <Autocomplete id="checkboxes-tags-demo" autoComplete={false} options={sta ...

The CSS code does not seem to be rendering properly within the plugin when attempting to generate a PDF file

I attempted to use a rendering plugin in order to create a PDF file. However, when I tried to add a CSS file for my template, it did not work as expected. I am a bit confused about how to properly import a CSS file into my GSP page. Here is the template c ...

Reactjs Rendering problem with retrieving data from the backend in a popover

Take a look at the test environment where this problem is occurring https://codesandbox.io/s/nice-cache-kl12v My website design is being done with antd. Right now, I'm facing an issue where I need to display notifications to the user, which are acces ...

What could be causing the issue with my Date and Time input not functioning correctly?

I developed a React frontend application styled with Material UI design. The issue I am facing is that after adding the Date and Time component styling to the form, it is unable to process the "name" value for posting. Specifically, the error message "Ty ...

AngularJS routing that is tailored to form input

I am trying to create a dynamic html page where the user can input form variables. My goal is to use AngularJS routing to navigate to different URLs based on the form inputs. Does anyone have advice or guidance on how I can achieve this functionality? ...

My a:hover isn't functioning properly and my <a> tag is not redirecting to the link when clicked. Can anyone help me troubleshoot these issues?

I've created a website with multiple stacked sections. Each section is contained within a div with the class class="concertDiv". In one of these sections, I want to display an album cover on the left side and three clickable text rows on the right sid ...

The desired outcome is not displayed following the Ajax post request

I have created an app that utilizes asynchronous AJAX requests to enable seamless chat functionality without refreshing the page. However, I'm facing an issue where the messages are not being displayed. When I inspect the network tab and navigate to t ...

Implementing custom styles in JavaScript according to the specific browser or platform

When it comes to adding multiple css styles to a dom element and ensuring compatibility across different browsers, which approach is more optimal for performance? Combining all prefixed css properties together, allowing the browser to decide which one ...