Trimmed down vector graphic

My setup includes a simple display with an .svg image that is slightly clipped at the bottom. The arrow image I am using comes from fontawesome. Can anyone explain why this clipping is happening?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .alpha {
      width: 50px;
      height: 50px;
      left: 0%;
      background: url('./arrow-right-solid.svg') 0 0 / 100% no-repeat;
    }
  </style>
</head>
<body>
  <div class="alpha"></div>
</body>
</html>

Answer №1

The issue arose when I set / 100%, causing an image to stretch to 100% in width, making it impossible to fit within the height constraints as it is not a square image.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .alpha {
      width: 50px;
      height: 50px;
      left: 0%;
      background: url('./arrow-right-solid.svg') 0 0 / contain no-repeat;
    }
  </style>
</head>
<body>
  <div class="alpha"></div>
</body>
</html>

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

Display title of link in mobile navigation menu

I would like to incorporate icons in my navbar instead of text, with the option for the title to be displayed on hover. The "title" text currently displays correctly on both mobile and desktop versions. However, on mobile display, I want the title text t ...

The div inside another div does not appear centered on Safari

Even though I've managed to center a div within another div, it seems to not be functioning properly in the Safari browser. #box{ width: 100%; height: 100%; position: relative; } ...

Opting for PHP over JSON in a jQuery live search code

Is it possible to modify my jQuery Google Instant style search script to pull content from a PHP script instead of using the BingAPI? Below is the current code being used: $(document).ready(function(){ $("#search").keyup(function(){ var searc ...

Personalize the file button for uploading images

I have a button to upload image files and I want to customize it to allow for uploading more than one image file. What is the logic to achieve this? <input type="file" />, which renders a choose button with text that says `no files chosen` in the sa ...

Send the form using an alternative method to avoid using preventDefault

Having some trouble with my website's sign-in functionality not working properly on all browsers. In Firefox, I keep getting a "ReferenceError: event is not defined" error. I've read through various posts about preventDefault behaving differentl ...

"Activate the parent window by navigating using the accesskey assigned to the href

I have integrated a bank calculator tool into a website. The calculator opens in a new window, but I am encountering an issue. Users need a shortcut to open the calculator multiple times. I have discovered the accesskey feature, which works the first tim ...

The font background color appears to be malfunctioning

body { margin: 0; background-color: white; background: linear-gradient(to right, #000000, #ffffff, #ffffff, #000000); line-height:25px; } h2{ color: black; text-align: center; display: block; font-family: 'Montserrat', san ...

Expanding a CSS div when the content wraps on smaller screens

When viewing the menu on standard screens, everything looks good. However, on smaller screens, the menu items start to wrap which is fine. The only issue is that the containing div #nav does not automatically enlarge along with it. I would like for the div ...

The appearance of HTML is acceptable in a browser but appears differently in an email

I'm encountering an issue with email encoding. After reading an HTML file from disk and sending it through Gmail, the content appears distorted when received. Even the list bullets are messed up! Despite encoding the file as UTF-8, everything looks fi ...

top-sticky and logo visibility

Struggling with an issue related to displaying a logo in a sticky header. The menu works, but need the logo to shrink when header is sticky. https://i.sstatic.net/jDNsb.png This is what I need: https://i.sstatic.net/szzRC.png My current code snippet: ...

Having trouble getting Javascript to reveal hidden elements based on their class

I am having some trouble making specific fields in a form appear based on the selection made from a dropdown menu. Below is a simplified snippet of my code, which should change the display from 'none' to 'block'. Can you help me figure ...

PHP and MySQL pagination made easy with CSS styling

I am attempting to create a basic php pagination system, or more specifically, a css pagination system with php/mysql. Retrieving and storing data from the database while($row = $result->fetch_assoc()) { $id[]=$row["id"]; $name[]=$row ...

Incorrect modal placement

I am new to CSS and currently working on customizing a modal window. My main issue lies with its positioning, especially when the browser resolution changes, causing a misalignment as seen in the screenshot. I would like to specify the width and height dim ...

Tips for positioning three child divs horizontally within a parent div with flexible dimensions and arranging each one separately

Is there a way to stack three divs horizontally within a fluid-width container div, with each child div scaling proportionally when the browser is resized for responsive design? The left-most div should be on the left, the middle div centered, and the righ ...

Refreshing a specific div without refreshing the entire page is currently not functioning as expected

Currently, I am involved in Java Portlets and Websphereportal development On a specific page, there is an option to delete or update a profile picture. The layout of the page consists of two divisions within my JSP file: <div id="fotoDefault" style="d ...

What is the process for making the default text in a text box appear grayed out?

Hey there! I have this cool idea for a text box. Basically, it starts off with default text but when you hover your mouse over it, the text disappears and you can start typing as usual: If you want to see how it looks like, you can check out this link: N ...

Is jQuery causing the table to exceed the page width?

I have a table in my HTML document that is displaying too many columns in a single row (~25), causing the table to stretch beyond the size of the page and creating unwanted scrollbars. I am seeking a solution to shrink the content of each column while also ...

In Internet Explorer, the list items are overlapping, while functioning perfectly in all other web browsers

I've encountered a strange issue with my list item in Internet Explorer. Despite working perfectly in Chrome and other browsers, it fails to function properly in IE. I've built this application using the Vue framework and have faced various probl ...

Requesting an image from the live website using a GET method

Recently, I registered a domain for my personal website. While the site is still a work in progress, I noticed that the logo image fails to display when viewed through the browser on the site. Surprisingly, it shows up perfectly fine when accessed via loca ...

Unexpected horizontal scrolling problem on my bootstrap webpage

I'm currently experiencing a horizontal scrolling issue on my Bootstrap page. Can anyone provide insight into why this might be happening? You can view my page here. Here is a snippet of my CSS code: @media (min-width: 1400px) and (max-width: 1440px) ...