Modify the css variable to expand the dimensions of the css image

Have you ever struggled to resize a graphic asset when working with CSS? Do you have any tools or tricks for making this task easier?

For instance, I came across this example on http://jsfiddle.net/awayF/491/

<span class="checkmark">
    <div class="checkmark_circle"></div>
    <div class="checkmark_stem"></div>
    <div class="checkmark_kick"></div>
</span>

Sometimes it can be frustrating spending over 10 minutes trying to adjust everything just right.

Answer №1

One way to magnify an element is by utilizing the zoom property.

.checkmark { zoom: 20; }

By setting the zoom level to 20, you can increase the size of the element by 2000%.

Answer №2

To adjust the size and position of the checkmark container, you can utilize the transform property with scale and translate functions.

Important: The transform property may not be supported by all browser versions.

For example:

.checkmark {
    display:inline-block;
    width: 22px;
    height:22px;
    -ms-transform: rotate(45deg) scale(4,4); /* IE 9 */
    -webkit-transform: rotate(45deg) scale(4,4); /* Chrome, Safari, Opera */
    transform: rotate(45deg) scale(4,4) translate(20px);;

}

.checkmark_circle {
    position: absolute;
    width:22px;
    height:22px;
    background-color: green;
    border-radius:11px;
    left:0;
    top:0;
}

.checkmark_stem {
    position: absolute;
    width:3px;
    height:9px;
    background-color:#fff;
    left:11px;
    top:6px;
}

.checkmark_kick {
    position: absolute;
    width:3px;
    height:3px;
    background-color:#fff;
    left:8px;
    top:12px;
}
<span class="checkmark">
    <div class="checkmark_circle"></div>
    <div class="checkmark_stem"></div>
    <div class="checkmark_kick"></div>
</span>

Answer №3

If you use percentages to size child elements, simply set a size to the parent element, such as .checkmark, and they will grow accordingly.

By implementing it this way, the circle will adjust properly when transformations are applied to the inner pseudo-element.

.checkmark {
  position: relative;
  display: inline-block;
  width: 75px;
  height: 75px;
}
.checkmark2 {
  position: relative;
  display: inline-block;
  width: 100px;
  height: 100px;
}
.checkmark_circle {
  position: absolute;
  width: inherit;
  height: inherit;
  background-color: green;
  border-radius: 50%;
  left: 0;
  top: 0;
}
.checkmark_circle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  height: 25%;
  border-left: 8px solid white;
  border-bottom: 8px solid white;
  -webkit-transform: translate(-45%, -70%) rotate(-45deg);
  -ms-transform: translate(-45%, -70%) rotate(-45deg);
  transform: translate(-45%, -70%) rotate(-45deg);
}
<span class="checkmark">
    <div class="checkmark_circle"></div>
</span>
<span class="checkmark2">
    <div class="checkmark_circle"></div>
</span>

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

Show a preview of an image in an HTML document

How can I display an image after uploading it? I attempted to use the following code, but it didn't work: onFileSuccess: function(file, response) { var json = new Hash(JSON.decode(response, true) || {}); if (json.get('status& ...

incorporating some margin to the left side of a text block

Is there a way to use margin-left:20px; to move a bullet point list on my webpage 20px inwards? <li>• Service level agreements to match your needs from next business day response to a two hour fix</li> <li>• 24x7x365 service coverage ...

Switch the Header Image on a Page in WordPress

I am currently using the Sunrise Theme from s5themes.com and I have a question regarding the header image on individual pages. It seems that all pages are displaying the same header image as the homepage, which is not what I want. Attached below is a scre ...

What steps can I take to ensure that the content within my bootstrap container always fits neatly within the container boundaries?

I'm attempting to structure one container with 3 rows. The first row contains the header, the last row the footer. In the middle row, I want two columns. The left column should display multiple scrollable cards. I've tried various methods to make ...

Using PHP to create an HTML table that can have variable rows and columns, with the data in each row depending on

My latest project involves an assessment system that evaluates each student's performance in every lesson. I have a form set up to generate a table with the following headers: Student name Student ID Lesson title Lesson ID Lesson grade In order to ...

What methods can I use to ensure that the columns and rows in Vue are of the same size and length

Upon examining the image, it's clear that none of the columns and rows align properly and are all varying sizes. I am relatively new to JavaScript and Vue, so any assistance would be greatly appreciated. As far as my understanding from online resource ...

Dependencies in AngularJS factories

I'm currently using AngularJS to extract data from mongodb. I have been attempting to utilize a factory to retrieve this information through the $http method. Despite researching and trying numerous approaches, none seem to work for me. In addition t ...

Adjusting the positioning of my webpage's content towards the header?

As a beginner in the world of HTML and CSS, I am currently working on customizing a Tumblr page. The template provided by the platform has been modified to include additional elements. However, I have encountered an issue where there seems to be a gap bet ...

Utilize Angular to transform a JSON string into HTML text featuring organized bullet points

I am currently working on a project using Angular and I need to display some data from a JSON file on a webpage. The issue I am facing is that the message is quite lengthy, and I would like it to be presented in bulleted points. "messageToDisplay" ...

Adaptable image display in Bootstrap 4

Having an issue with responsive images in Bootstrap 4.0. Used class="img-fluid" but it doesn't seem to be functioning. Checked using a Chrome add-on on another device (iPhone 4) and the image did not scale with the device's monitor. https://i.s ...

Avoid displaying the image when encountering a 404 error, but sometimes a broken image may still appear momentarily

Here is the code snippet I'm currently using: <img ng-show="json.user.picture" ng-src="{{json.user.picture}}" ng-error="json.user.picture = false"> When accessing an image from an external website without permission, a 404 error code is return ...

Is there a way to trigger the type() function once the erase() function finishes its execution?

Experience a typing animation JS with two functions that work correctly: the type() function activates when the type button is clicked, and the erase() function triggers upon clicking the Erase button. Now, the challenge is to introduce a new function cal ...

When printing, the CSS for media print is not correctly displaying the table format

I have a basic table with a button underneath. This code snippet is located in the body section of my JSP file: <div id="myDivForPrint"> <table class="t1"> <tbody> <tr> ...

Is there a way to automatically focus on a newly created element using JavaScript?

Whenever a user presses the enter key in a single input field, it will become disabled and a new one will appear. I am looking to automatically focus on the newly created input field each time, while also removing the default blue border that appears when ...

Selenium alert: element click blocked: Another element is in the way of receiving the click

I'm currently using Selenium in an attempt to click on the "show more" option under the "about this show" section on the following URL: https://www.bandsintown.com/e/1024477910-hot-8-brass-band-at-the-howlin'-wolf?came_from=253&utm_medium=we ...

The execution of the code may encounter errors initially, but it generally runs without any issues on subsequent attempts

I recently developed a piece of code to ascertain whether a value in the database is null or not. Here's the snippet: var table; var active = false; function CheckActive(table){ this.table = "table" + table + ""; var db = window.openDatabas ...

How to adjust the grid-gutter-width in Bootstrap 4.5 container?

If we want to change the $grid-gutter-width: 30px !default; variable specifically for the .container class, we can do so in the _variables.scss file. For example: .container { padding-left: 40px; padding-right: 40px; } Where can I make this custo ...

Despite configuring my httpheaders, I am encountering an access denied error when trying to retrieve an HTTP header

I have retrieved a list of users from a database using a Spring Boot API. Each user in the list has different attributes such as username, id, first name, last name, registration date, and profile photo. The profile photo is identified by an image ID whic ...

Incorporating the FLEX property into my code has been a challenge as it is not functioning properly on iOS 7 and 8 devices. Does anyone have any tips or suggestions on how to

While utilizing FLEX in my code, I noticed that the output is not what I expected on iOS 7/8 devices. <div className="modal-row"> <div className="col1"> <span>{dict.YourServiceNumber}</span> </div> <div ...

The V-model binding feature seems to be malfunctioning on mobile devices, unless I incorporate an alert into the

Encountering a strange issue with form input binding in my Vue application. The input field is an auto-suggest search field with the following set up: <input class="input" type="text" v-model="search" @input="onChange" @keyup.up="onArrowUp" @keyup.down ...