What are the steps to design a basic circle in CSS3 that allows for easy movement and resizing of the background image?

I attempted to achieve a specific effect with my code snippet:

    .mask {
        width: 200px;
        height: 200px;
        border-radius: 50%;
        -webkit-border-radius: 50%;
        -moz-border-radius: 50%;
        background: url(http://lapeniche.net/wp-content/uploads/2013/12/Chat.jpg) no-repeat;
       background-position: -50px -50px; /* this allows to move the image inside */
      /* but how to resize the CAT picture ???? */
    }
<img class="mask">

While I managed to adjust the position of the image using background-position, I struggled to resize the background picture.

I experimented with css3 masks, however, unfortunately, it only seemed to work in Chrome.

  -webkit-clip-path: circle(100px at 150px 150px);
    -moz-clip-path: circle(50%, 50%, 30%);
    clip-path: circle(50%, 50%, 30%);

Does anyone have any suggestions or solutions?

You can view the fiddle here: http://jsfiddle.net/nnr64y3b/

The objective is to create a rounded circle where I can alter both the position and dimensions of the inner image.

Answer №1

If you want to adjust the background size, consider using this code snippet:

background-size: x% x%;

For more information on CSS background size properties, visit this link.

To see a demo of how it works, check out your fiddle: here.

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

The functionality of a div element appears to be impaired when attempting to include a newline character

I have a div element <div id="testResult" style="padding-left: 120px;"> My goal is to include text with newline character '\n' inside the div. However, when I view my html page, the text does not respect the newline character. $( ...

The table is refusing to align itself in the center

I've been struggling to center the text inside this table despite trying various solutions. Any help would be greatly appreciated. Here's the HTML code I have: <div id="paccount"> <table style="margin: 0 auto;"> <tr&g ...

Is it possible to adjust the position/target values of a webkit CSS transition without interrupting its operation

Is there a way to smoothly change the target position or attributes of a running transition without halting it? To illustrate, let's consider this initial animation: -webkit-transition:-webkit-transform 5s ease-in-out -webkit-transform: translate3d( ...

Updated: "Adjust the preserveAspectRatio attribute in the SVG element within the Lottie player"

I have successfully incorporated a lottie json file using the lottie player. Unfortunately, I do not have access to the SVG file itself, only the json file. My goal is to modify the preserveaspectratio attribute of the SVG to xMinYMax meet instead of xMi ...

Sending data through URL links in HTML

$.post("/diabetes/ropimages/getcount.php",{patientId:$("#patient_id").val()} ,function(data1){ //alert(data1); var count = data1; var patientId = $("#patient_id").val(); var reportId; for( var i = 1 ; i <= count ; i++) { var imageLink =&a ...

Center Items in Flexbox, Implementing React Material with React

In my React App, I am utilizing flexbox and React Material to align the searchbar and clear button on the same line with space between them. Here is the link for reference: CLICK HERE <div className={classes.searchBarSection}> <Paper com ...

Using .attr() to change the 'id' in jQuery will not be effective

Initially, the code has been streamlined to include only the necessary components. Here is the HTML file (single_lesson.html) in question: <tr class="my_lessons"> <td> <select name="my_von" id="my_von"></select> &l ...

The red solid outline of 1px is not functional when attempting to enlarge on hover

Recently, I stumbled upon a PSD design that really caught my eye. https://i.sstatic.net/R46Ko.jpg It inspired me to create a website similar to . One feature I particularly liked was how a circle appeared when hovering over a link. Plus, I plan on using ...

jQuery's feature to select all elements except one and its children appears to be malfunctioning in Safari

My goal is fairly simple. I want to make the entire section clickable, except for the span and anything beneath it, so that the link redirects elsewhere. <section id="id" class="message"> <div class="message_body"> <font color="color"> ...

Prevent Bootstrap 4 from causing content to shift downwards when collapsing

Currently, I am utilizing Bootstrap 4 Collapse and it is functioning flawlessly. However, I am interested in making a slight adjustment. Is there a method to prevent the collapse from pushing down the content below it and instead have it overlap? If this i ...

Master the art of keeping track in just a single line

I need to ensure these tabs stay in a single line and remain responsive for mobile devices. Below is the code snippet: <div class="navbar"> <div class="navbar-inner"> <ul class="nav nav-tabs"> <li class="active"& ...

Having trouble capturing a photo from webcam using HTML5 and getUserMedia() in Google Chrome upon initial page load

Using the information from an article on HTML5Rocks, I am attempting to create a tool that can capture photos from a webcam. Here is an excerpt of my HTML code: <button type="button" name="btnCapture" id="btnCapture">Start camera</button>< ...

Seamlessly transition between various states within a React component for a fluid user experience

I'm currently working on a simple component structured like this: var component = React.createClass({ render: function(){ if (this.props.isCollapsed){ return this.renderCollapsed(); } return this.renderActive() }, ren ...

Save and showcase SQL, PHP, HTML, and JS code exactly as it is preserved in MYSQL database

Is there a way to store and display complete JS, PHP, and HTML code in MySQL without altering the format? The stored PHP code should appear as: <?php echo "something"; ?> And not just: something For JavaScript: <script> document.write(&ap ...

How can I extract information exclusively from child nodes with Jsoup?

Currently, I am facing an issue with extracting first-level <li> elements from a <ul> element. Even though I attempt to retrieve only the first-level <li> elements using Jsoup selector or getElementsByTag, the nested <li> elements w ...

What is the best way to align two items where one is centered and the other is positioned to the left?

In an attempt to customize a chat call to action, I am looking to have an icon aligned to the left and some centered text. Here is an example of how I envision it: [ @ Text aligned in center ] Here is what I have tried so far: .icon{ justify-self: ...

Creating Sleek Rounded Corners with Pure CSS in Older Versions of Internet Explorer (Compatible with jQuery)

Looking for a seamless solution to render rounded corners on browsers that do not support CSS3 without the delay typically seen with JQuery plugins. The use of .htc files with www.css3pie.com seems like the best option so far, but there is still a delay c ...

Reset button for jQuery form to clear all inputted values

My form has a reset button that is supposed to clear all entered values, but it doesn't seem to be working properly. After checking the Firefox console tab for errors, I noticed an 'illegal character' error at the end of my jQuery script. C ...

How you can incorporate an icon in between menu items using Bootstrap 4

As a novice web developer, I am currently utilizing Bootstrap 4 in my project. Here is the code snippet I have created: .footer-menu a{ color: #2D2D2D; font-size: 1em; } .copyright{ color: #D1D1D1; font-size: 0.9em; } <footer> ...

The functionality of min-height in CSS seems to be malfunctioning

One of my HTML elements has a parent with the ID #out, and a child with the ID #in. The parent is positioned absolutely, with a minimum height of 100%. It seems to be functioning correctly in most browsers, except when I also set the child's min-heigh ...