Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9162803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:17:59+00:00 2026-06-17T14:17:59+00:00

I’m using CSS3 borders to create shapes that users can then drag images onto

  • 0

I’m using CSS3 borders to create shapes that users can then drag images onto it.

The problem is, I’d like the image to take the shape of the div.

Can this be done with CSS or would I need to do this using jQuery?

Thanks

EDIT:

 <div class="my-div">
     <img class="div-image" src="image.jpg" />
 </div>

 border-left: 300px solid red;
 border-right: 200px solid transparent;
 border-top: 30px solid transparent;
 border-bottom: 25px solid transparent;

This creates a box with slanted sides in the shape i want the image to be

Here is an example: jsfiddle

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:18:01+00:00Added an answer on June 17, 2026 at 2:18 pm

    The real problem here is using CSS borders to hack shapes.

    If you want to do what you’re asking, you need to be using a better solution — ie create shapes using real graphics (probably SVG or Canvas) rather than faking it in CSS. CSS shapes are very limited, and only really useful for showing off the fact the CSS can do them at all. They’re not really much use in practice.

    My suggestion would be SVG. SVG is a vector graphics format that can be embedded in an HTML page, and would be a far better solution to your question. You can easily create an element of any shape you want, and fill it with an image. The only down-side of SVG is that it isn’t supported by older browsers (IE8, for example), but this can easily be worked around, as IE8 supports an alternative format called VML. Several Javascript libraries exist that will work with either SVG or VML

    I recommend you look up a library called Raphael. See the examples on their site for some of the things you can do. It’s all really pretty easy. You will need to learn some new syntax, but once you’ve got the basics, you’ll be amazed at what you can achieve.

    [EDIT]
    I’ve just seen your edit to the question with the JSFiddle example of what you’re trying to do.

    The reason the JSFiddle doesn’t work is because the shape you’re seeing with the grey background is made up of the borders. Box borders are displayed on top of box content. In your case, the box borders take up the entirety of the box itself,so your grey borders are all you get to see. The image is loaded but hidden behind the box. I’ll repeat what I said originally: CSS Shapes are not a good solution for anything other than simple hacks. Use SVG if you want a robust solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am using JSon response to parse title,date content and thumbnail images and place
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am using jsonparser to parse data and images obtained from json response. When
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.