How to Scale Images from the Right using CSS?

article img {
    width: 100%;
    height: 350px;
    -o-object-fit: cover;
    object-fit: cover;
}
<article>
  <img src="https://i.ibb.co/84FnVcK/Group.png">
</article>

Can the 'This needs visible' text be preserved on the image as it scales from a different angle? Please note that in some images, 'This needs visible' is actually a logo which may fall off when the window size decreases (responsive design)

The text can slide off here

https://i.sstatic.net/GjCI0.png

Answer №1

Consider using object-position: left center, similar to how background-position works, it sets the reference point when resizing an image.

article img {
    width: 400px;
    height: 600px;
    -o-object-fit: cover;
    object-fit: cover;
    object-position: left center;
}
<article>
  <img src="https://i.ibb.co/84FnVcK/Group.png">
</article>

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

Adding 'foobar' to innerHTML using JQuery

I want to add new content instead of removing the existing one. I have been using the element.innerHTML += 'foobar' method for this purpose, but now I am trying to learn how to use jQuery. I came across the $().html('') function, but it ...

Tips for turning off dates on a calendar using JavaScript

Here is the code snippet I'm working with: $(".datepicker").datepicker(); $(".datepicker-to").datepicker({ changeMonth: true, changeYear: true, maxDate: "0D" }); Next, let's take a look at my input fields: <div> <span& ...

Modify the CSS of one div when hovering over a separate div

I've been working on a simple JavaScript drop-down menu, and it's been functioning correctly except for one issue. When I move the mouse out of the div that shows the drop-down menu, it loses its background color. I want the link to remain active ...

Developing a jQuery Plugin to Generate an Interactive Dropdown Menu

I have a task to dynamically create a select list in which users can add options after the select list has been created. Check out my code snippet below: <script type="text/html" id="select_field"> <div class='row& ...

"Error" - The web service call cannot be processed as the parameter value for 'name' is missing

When using Ajax to call a server-side method, I encountered an error message: {"Message":"Invalid web service call, missing value for parameter: \u0027name\u0027.","StackTrace":" at System.Web.Script.Services.WebServiceMethodData.CallMethod(O ...

Hide element with jQuery if either of the two divs are currently visible

Initially, I have 2 hidden div elements: <div id="hidden1" style="display:none;"> <div id="hidden2" style="display:none;"> In addition, there is a visible div: <div id="visible" style="display:block"> A jQuery script ensures that only ...

"The Issue with Dropdowns in Older Versions of Internet Explorer (IE8 and Below

Greetings! I recently revamped my website to include drop-down menus, but unfortunately, I discovered that in IE 8 and earlier versions, the display is far from ideal. The menus appear correctly on all other browsers except for Internet Explorer. I have b ...

Boot up 4 collapse feature to conveniently close all other collapsible items at once

Utilizing the Bootstrap 4 Collapse component. My goal is to toggle between collapsible sections like "Categories" and "Brands", displaying only one at a time. The current issue is that multiple collapsible elements are visible simultaneously. .view-cust ...

Modify the style of an element using a media query and Angular 4

Is there a way to update a class of an element based on the browser's width in my .ts file? matchMedia('(max-width: 400px)').addListener((mql => { if (mql.matches) { this.myclass = 'toggled'; } })); In the HTML, it shou ...

Can JavaScript be used to iterate through the id attribute of an image tag?

Check out my amazing code snippet created with HTML and Javascript: <html> <body> <img id="img0" style="position:fixed; width:116px; height:100px;" > <img id="img1" style="position:fixed; width:116px; height:100px;" > ...

Customizing the appearance of the dragged element in jQuery UI

Is there a way to modify the color of a draggable list item after it has been dragged? Any assistance is greatly appreciated. $("#DragWordList li").draggable({helper: 'clone'}); ...

Issue with showing error message to the user using AJAX

Using AJAX code to manage errors from the backend. Everything is functioning properly, but I want to display the errors individually to the user in a numbered list. Desired Output 1. Please enter a valid phone number 2. Please provide your email address ...

Obtain a masterpiece by creating a canvas in React

Greetings! I have developed a drawing app using react and I am looking for a way to capture what the user has drawn on the canvas when they release the mouse button. This process should repeat continuously until the user stops drawing. Can anyone suggest h ...

Failed to add a new entry to the Sharepoint 2013 List

Having trouble saving an item to a SharePoint list using Knockout.js and REST. In my Ajax POST request, I've used ko.toJSON but the entry doesn't show up in the SharePoint list. It's possible that I'm passing the wrong parameter value. ...

Divide the adaptive navigation bar into two separate columns

I'm currently working on a website called and utilizing the free version of . The menu will be displayed for devices 400px and smaller. Is there a way to divide its columns into 2 like this? https://i.sstatic.net/Ac5Do.jpg I am unsure how to adjus ...

SwipeJS is not compatible with a JQuery-Mobile web application

I am currently attempting to integrate SwipeJS (www.swipejs.com) into my JQuery-Mobile website. <script src="bin/js/swipe.js"></script> <style> /* Swipe 2 required styles */ .swipe { overflow: hidden; ...

Creating a variable with the use of @include

Here's a question that I need help with. I have a SASS @include function that dynamically calculates the font size. h2 { @include rfs(2rem); } I use this to adjust the font size based on screen resolution, but I'm facing an issue where a gre ...

When working with Vue.js, toggling the 'readonly' attribute of a textarea between true and false may not be effective

My goal is to accomplish the following: Allow the textarea to be edited when double-clicked; Prevent the textarea from being edited when it loses focus; However, regardless of toggling the 'readonly' attribute, I am currently unable to achieve ...

Formatting dynamically generated HTML using C#

My ASP.NET web forms site has a large menu that is dynamically generated using C# as a string. The HTML code returned looks something like this: <ul><li><a href='default.aspx?param=1&anotherparam=2'>LINK</a></li> ...

Leveraging AngularJS to present vertically-stacked information with the Bootstrap Grid System

Attempting to utilize AngularJS and Bootstrap for creating a hierarchical data display has been my recent project. Thanks to the collaboration of fellow stackoverflowers, I was able to implement a smooth sliding effect using bootstrap badges to showcase ca ...