Resolve the issue of text overlapping on an image when zooming in

There seems to be an issue with overlapping text and images when zooming the page. I have included a screenshot for reference, please take a look and provide a solution. Thank you in advance.

Here is the CSS code causing the overlap:

.Pad{
    padding: 60px 0px;
    margin-top: -300px;
 }

 body {
    margin: 0;
}

.outer-div-for-the-imgae-icon{position:relative; display:block; height:300px; width:300px;   }

.outer-div-for-the-imgae-icon img{height:300px; width:300px; object-fit:cover;}

.outer-div-for-the-imgae-icon i{position:absolute; top:0; left:100%; font-size:40px;}

This is the HTML code contributing to the issue:

<div class="col-12 col-12 p-0">
                        <div class="col-6 float-left">
                            <div class="outer-div-for-the-imgae-icon">
                                <app-image [imagesrc]="imagePath" style="width: 190px;max-height: 190px;clip-path: square(25px at center);"
                                    class="d-none d-sm-block" alt="..."></app-image>
                                <i (click)="inputFile.click()" style="color : white;left: 180px; 
                                position: absolute; top: -5px; padding: 3px; background-color: rgb(0, 195, 255); 
                                border-radius: 50%;font-size: 12px;"
                                    class="fa fa-pencil fa-lg" aria-hidden="true"></i>
                            </div>

                            <div class="col-6 Pad float-right">
                                <div class="col-sm ">

                                    <span class="name">
                                        <b style="color: rgb(25,25,112); font-size : 15px ">{{myprofile?.FirstName}}
                                            {{myprofile?.LastName}}</b>
                                    </span>
                                </div>

                                <div class="col-sm">

                                    <span class="name">
                                        <p>{{myprofile?.Role}}</p>
                                    </span>
                                </div>

                                <div class="col-sm">

                                    <span class="name">
                                        <p>{{myprofile?.Phone}} {{myprofile?.UserName}}</p>
                                    </span>
                                </div>
                            </div>
                        </div>



Answer №1

Hello Sandeep, I recommend trying out this new CSS code for your website. Feel free to adjust the minimum and maximum width and height values according to your preferences:

.image-container {position:relative; display:block; min-height:200px; width:100%; height:auto;} .image-container img{max-height:250px; width:100%; max-width:250px; height:auto; object-fit:cover;} .image-container i{position:absolute; top:0; right:0; font-size:30px;}

The overlapping issue may be due to the fixed width and height of the image element. Let me know if this works better for you!

Answer №2

UPDATE:

After some modifications, here is the revised code snippet for you:

<style>

.Pad{
padding: 60px 0px;
margin-top: -300px;
}

body {
margin: 0;
}

.outer-div-for-the-imgae-icon{position:relative; display:block; height:300px; width:300px;   }

.outer-div-for-the-imgae-icon img{height:300px; width:300px; object-fit:cover;}

.outer-div-for-the-imgae-icon i{position:fixed; top:0; left:100%; font-size:40px;}

</style>

<html>
    <body>
        <div class="col-12 col-12 p-0">
            <div class="col-6 float-left">
                <div class="outer-div-for-the-imgae-icon">
                    <app-image [imagesrc]="imagePath" style="width: 190px;max-height: 190px;clip-path: square(25px at center);"
                               class="d-none d-sm-block" alt="..."></app-image>
                    <i (click)="inputFile.click()" style="color : white;left: 180px;
                                position: absolute; top: -5px; padding: 3px; background-color: rgb(0, 195, 255);
                                border-radius: 50%;font-size: 12px;"
                       class="fa fa-pencil fa-lg" aria-hidden="true"></i>
                </div>
                <div class="col-6 Pad float-right">
                    <div class="col-sm ">
                        <span class="name">
                            <b style="color: rgb(25,25,112); font-size : 15px ">{{myprofile?.FirstName}}
                                {{myprofile?.LastName}}</b>
                        </span>
                    </div>
                    <div class="col-sm">
                        <span class="name">
                            <p>{{myprofile?.Role}}</p>
                        </span>
                    </div>
                    <div class="col-sm">
                        <span class="name">
                            <p>{{myprofile?.Phone}} {{myprofile?.UserName}}</p>
                        </span>
                    </div>
                </div>
            </div>
            <div id="over" >
                <img src="https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg"> some text
            </div>
            <div style="padding-left: 100px;" class="col-6 float-right">
                <div class="col-12 ">
                    <div class="office-address-heading">
                        <p class="Address">Office Address</p>
                    </div>
                    <div class="d-flex align-items-center">
                <!-- <i style="color:grey;" class="fa fa-map-marker fa-2x mr-2" aria-hidden="true"></i> -->
                <address class="mb-0 size">
                    {{myprofile?.OfficeAddress}}
                </address>
                    </div>
                </div>
                <hr />
                <div class="col-12">
                    <div class="office-address-heading">
                        <p class="Address">Communication Details</p>
                    </div>
                    <div class="d-flex align-items-center office-address-details ">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style ="right: 14px;">
                            <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5 float-left">
                                <i class="fa fa-phone fa-2x mr-2" aria-hidden="true"></i>
                                <a style="color: black;" href="tel:1-562-867-5309">{{myprofile?.Phone}}</a>
                            </div>
                            <div class="d-flex1 col-xs-12 col-sm-12 col-md-8 col-lg-7 align-items-center office-address-details float-right ">
                                <i class="fa fa-envelope fa-2x mr-2" aria-hidden="true"></i>
                                <a style="color: black;" href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="abd9cacdcacec785c8cedbcecfcaebc7dbc785c8c4c6">[email protected]</a>">{{myprofile?.Email}}</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

By implementing these changes, you can achieve the desired outcome:

view image here

I have specifically adjusted the CSS for the image container to prevent overlap with text. Please let me know if there are any concerns or queries.

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

What is the method for swapping out the <button> element with the enter key?

I have a webpage where users can post status updates, and other users can comment on these statuses by typing in the textbox and clicking the 'Reply' button. However, I would prefer to remove the button so users can simply press the enter key to ...

Inconsistency in field generation in WordPress Contact Form 7 causing issues

After utilizing the WordPress plugin Contact Form 7 to put together a straightforward questionnaire, I discovered that two fields, Your Birthday and Your Email, were mistakenly generated on top of one another in the final output. You can take a look at th ...

Content within a div that is floated left

The scenario at hand is: HTML Structure: <div id="main"> <div id="a"></div> <div id="b">Some Text</div> </div> CSS Styles: #a{ float:left; width:800px; height:150px; background-color:#CCC; } ...

Using Angular 2, perform an HTTP GET request to retrieve data from a JSON file located in the assets folder

Currently, I am working on fetching data from a JSON file located in the assets folder of my application. The framework I am using is Angular Material. For this purpose, I have created an account component which consists of the following files: account.co ...

Angular - Is there a specific type for the @HostListener event that listens for scrolling on the window?

Encountering certain errors here: 'e.target' is possibly 'null'. Property 'scrollingElement' does not exist on type 'EventTarget'. What should be the designated type for the event parameter in the function onWindow ...

Is it possible for images underneath to receive focus when hovering over them?

I'm struggling with a layout of thumbnails on my page. We'll refer to them as A, B, C, etc. They are currently displayed like this: A, B, C, D, E, F, G, H, I, J, K, L, M, N... and so on. When you hover over one thumbnail, it enlarges by 2.5 t ...

How can I use XPATH to target a div after choosing a nested element?

I had the task of creating a universal identifier to locate a dropdown menu following a label. There are 10 different forms, each with a unique structure but consistent format, which means I cannot rely on specific IDs or names. Instead, my approach was to ...

Creating a functional dropdown form in Ruby On Rails: A Step-by-Step Guide

Having an issue with implementing a dropdown form in the navigation bar of my Rails application. The problem arises randomly - sometimes it works smoothly, while other times I have to refresh the page for it to function properly. The Rails version being u ...

Embed Javascript Code Within Text Field

Is there a way to incorporate this JavaScript into the "price" text value? Below is the code snippet: <script> function myFunction() { var x = document.getElementById('car-select')[document.getElementById('car-selec ...

switch the visibility of the p tag based on its content

It seems like solving this shouldn't be too challenging, but I'm still learning when it comes to Javascript or JQuery. HTML: <p><span id="AddLine1Summary"></span>,</p> <p><span id="AddLine2Summary"></span& ...

When an input field is added to an HTML form, all elements positioned below it automatically inherit its attributes

I have a unique combination of HTML and CSS code that creates an impressive login form: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Prepare to be amazed...</title> <l ...

Firefox failing to display input placeholder text properly when wrapped

I've been working on making my placeholder text wrap to the next line in an input field. While I found solutions that work in Chrome, I'm struggling to get it right in Firefox. After researching on Stack Overflow, I came across this question: P ...

In order to access the localStorage from a different component, a page refresh is required as it is

UPDATE: Just to clarify, this question is NOT duplicate of how to retrieve the value from localstorage. My scenario is unique and the issue lies with Angular itself rather than localStorage. I am currently developing an Angular7 application. In one of my ...

Can CSS be used to consistently position content in a specific manner?

I previously inquired about a similar issue and received an excellent solution. Here is my jsbin http://jsbin.com/nuwagibayo/1/edit?html,css,output where I encountered the following scenario: The positioning of 12.50 seems slightly awkward in its current ...

Incorporate Material Design Lite and AMP into your Angular 5 project for a sleek

Looking to develop an e-commerce progressive web app using angular 5. Wondering how to incorporate AMP with angular 5 in Google Material Design Lite. If not viable, what are some alternative options worth considering? ...

Converting input tag to a method in component with uppercase transformation

Currently, this code resides within the <input tag I am looking to convert this code into a method in my component. Any ideas on how to do this? oninput="let p=this.selectionStart; this.value=this.value.toUpperCase(); this.setSelectionRange(p,p) ...

The sticky position is malfunctioning even when there is no parent element with the overflow hidden property

// observer for feature section let featuresSection = document.querySelector('#featuresSection'); let callbackFeature = (items) => { items.forEach((item) => { if (item.isIntersecting) { item.target.classList.add("in ...

What could be causing the malfunction of the Facebook iframe like button?

Even though it functions offline, there seems to be an issue with its performance online. Here is the code that was used: <iframe src="http://www.facebook.com/plugins/like.php?app_id=125925834166578&amp;href=http%3A%2F%2Fwww.facebook.com%2FBaradei. ...

Executing a jQuery script on various elements of identical types containing different content (sizes)

I am currently working on a jQuery script that will center my images based on the text block next to them. Since I am using foundation 5, I have to use a jQuery script to override the CSS instead of using vertical-align: middle. The script looks like thi ...

I am in the process of troubleshooting why the header does not redirect correctly when clicked

As I work on developing a user authentication script for my database, I encounter an issue when trying to match the information in my MySQL database upon clicking a button. For some reason, nothing seems to happen regardless of whether the login informatio ...