My div is being overrun by CSS image overflow

I currently have 3 divs with a height of 100vh, but when I view them responsively, the images overflow. You can see the issue in the image attached below. Apologies for any language barrier!

Here is the HTML structure:

<section id="services" class="container content-section text-center">
    <div class="col-lg-8 col-lg-offset-2">
        <div class="row">
            <div class="col-lg-6">
                <h2>Services </h2>
                <ul> 
                    <li>Carpooling </li>
                    <li>Food </li>
                    <li>Accommodation </li>
                </ul>
            </div>
            <div class="col-lg-6">
                <img src="img/mockup-iphone.png" alt="mockup iphone" class="img-responsive"/>
            </div>
        </div>

</section> <!-- close about -->
<section id="communities" class="container content-section text-center">
          <div class="row">
            <div class="col-lg-6">
                 <img src="img/mockup-iphone.png" alt="mockup iphone" class="img-responsive"/>
            </div>
            <div class="col-lg-6">
                <h2>Communities </h2>
                <ul> 
                    <li>Text </li>
                    <li>Text </li>
                    <li>Text </li>
                </ul>
            </div>
        </div>
</section>

Below is the relevant CSS code:

#services{
    width: 100%;
    height:100vh;
    background-color: #62b030;
}
#services img{
    height:90%;
}

https://i.sstatic.net/e9nxV.jpg

Answer №1

Consider resizing the image to be no taller than 80% of the viewport height, or using max-height: calc(100vh-100px) with overflow:hidden for better display in the #services section. Adding specific width and height values to your img-responsive or img class could also help optimize the image appearance.

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

How can a multicheck dropdown similar to Gmail be developed using HTML, CSS, and Bootstrap 4?

I am working on creating a multicheck dropdown similar to the one used in Gmail. Here is an example of what I have accomplished so far : https://i.sstatic.net/X5eIg.png However, I am not satisfied with how it looks. Could someone please provide suggesti ...

The content is unclipped with a border-radius and hidden overflow

As I work on incorporating stylistic text inside rounded divs, I encounter a challenge where the text touches the top of the container. While I have successfully managed to customize various content elements such as nested divs and background images, this ...

Error: JavaScript Framework (JSF) application experiencing issues with jQuery functionality

I am a beginner when it comes to jQuery. In my Netbeans project, I have the jquery-1.7.2.js file where all HTML files are stored. Currently, I am working on creating a JSF 2.0 project. Below is the code snippet I am using: <?xml version='1.0&apo ...

Modifying a leave transition in Vue.js dynamically following the completion of an enter transition

I am dealing with a dynamic transition for a slider element that moves left or right. Vue only allows me to have one transition, so I am using a dynamic transition property like this: <transition v-bind:name="'slider-' + slideDirection"> ...

Creating a form element in JavaScript and submitting it - step by step tutorial

Is there a way to redirect to a different page once a JavaScript process running on the current page is finished? The issue here is that only JavaScript knows when it's complete, and I'm using Python (Flask) as my web framework. One solution I th ...

Unable to process form submission with AngularJS + Stormpath

I am facing an issue with form submission. Even though I believe that the login and password data are being sent correctly, nothing happens when I submit the form. I am attempting to submit the form without using ngSubmit because it is not feasible in my s ...

How can you exhibit various images without relying on the <img> tag?

Is there a more efficient way to display over 500 images from a folder on an HTML page without the need to manually write out each img src tag? I have searched online for solutions, but most suggestions involve using PHP or "glob", which I am hesitant to ...

The validator on the W3 Schools website flagged an error for me

Has anyone encountered this particular validation error from W3 School before? I have a basic IMG element that is throwing an unusual error on line 43, column 112. I am completely baffled. Error Line 43, Column 112: Attribute target is not allowed on the ...

Using Angular with the Materialize framework's datepicker

How can I retrieve the selected date from a materialize datepicker? Here is my input code snippet: <div class="input-field col s3"> <input id="buyDate" class="datepicker" type="text" name="buyDate" ng-model="buyDate" materialize-date-pick ...

JavaScript code to alter the timeout duration for image changes: Update

I am working on a fun project that involves alternating between two images, one green and the other black. Here is the code snippet: <script> var switchImage = 1; var delayTime = 500; switchImages() function switchImages() { if (switchImage == 1) ...

Using Python/Django to strategically escape strings within HTML

My current task involves working with email content that is formatted in html. I have noticed that email addresses are structured similarly to html tags. Is there a method to selectively escape certain strings in html code while leaving others unchanged? ...

Implement a click event for the newly added item

I am struggling to attach a click event to an element that I dynamically added using jQuery. When the item is present in my HTML code, everything works as expected. Please refer to the code below for clarification: HTML <div id="addNew">Add new Ite ...

Hover over a picture to reveal hidden text

Is there a way to create a text overlay on an image with the text box appearing directly over where the image is positioned, causing the image to disappear completely? When the mouse moves away, the image should reappear. I have looked everywhere for a s ...

It seems like Chrome does not recognize 0 as a numerical value

Take a look at this snippet of HTML code: <!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <form name='test'> <input type='number&apo ...

Exploring creative methods for incorporating images in checkboxes with CSS or potentially JavaScript

Although it may seem like a basic question, I have never encountered this particular task before. My designer is requesting something similar to this design for checkboxes (positioned on the left side with grey for checked boxes and white for unchecked). ...

Ways to customize the appearance of a form element when an input is active

Looking for tips on how to style the input[type=submit] element when the input[type=text] is in focus. Consider this scenario: <form id="example"> <input type="text" name="search"> <input type="submit" value="Search"> </form& ...

Combine various input data and store it in a variable

I am looking for a way to add multiple input text values together and store the sum in a variable. Currently, I can add the values and display it in an id, but I want to assign it to a variable instead. The condition for this variable is described below af ...

I'm attempting to create an HTML document using the Shruti font (Gujarati Unicode), but instead of displaying correctly, it is showing strange, random symbols

Attempting to create an HTML file utilizing the Shruti font (Gujarati Unicode), but encountering random symbols instead. I have experimented with various methods, including the mpdf library, without success in importing the Shruti font. ...

Issue with Ionic 2: background image does not fully cover the entire page

In my Ionic 2 application, I am attempting to set a background image on a page. The view includes slides, but I want the background image to remain fixed behind them. It's almost there, but there is a noticeable black line at the top that the backgr ...

How do you center an inline-block div inside its parent div using CSS?

(Code: http://jsfiddle.net/T4hrK/) I have been searching endlessly, but cannot seem to find a solution. I have an outer div, and within it, I wish to center an inner div. This inner div contains numerous inline elements (such as images in a gallery) that ...