Save HTML inside div as image - asp.net

I've got a div where the user has dropped different image elements. They have also rotated, resized and changed opacity. All is done with CSS and the styles are placed inline on each element inside the div. I now need a way to save the "artwork" as a picture. I'm using CSS3 so the rendering-engine that converts HTML to image has to support this.
Any suggestions?

Since you're using CSS3 anyway, it's probably safe to also use the new Canvas API: https://developer.mozilla.org/en-US/docs/HTML/Canvas/Pixel_manipulation_with_canvas
You can use getImageData() to save to bitmap.

Related

How to change SVG color when I reach the bottom of the page

Have a react page and I want the SVG to change from black to white at the bottom of the page. Is there a way I can do this in react? The div container at the bottom of the page is not the parent div for the svg. The SVG is part of a stickied header
To detect if a user has reached the bottom of a page you can attach an event listener to the scroll event and compare a node's scrollHeight, scrollTop, and clientHeight properties. Read answers to a similar question to see exemplary implementations.
In reality this is not so much related to react as to the SVG itself.
My question would be, is your SVG included as an <img ...> tag or inline.
If it's an image tag you could use filters.
But if your SVG is a complex image with different colors, I would recommend you converting it to a component and using it as inline code.
That way you have way more control on what's happening with the SVG and then you just modify the path or shape's fill to fill: white.
As for when it gets to the bottom there are different options, you could check scroll position compared to viewport height or if you want something more specific you could use something like React Waypoint.

how to Use CSS only to add the appropriate logo images each p

Use CSS only to add the appropriate logo image next to each solution. This means that you won’t be adding an tag to the page to get the image to appear. It will be added using CSS and formatted with CSS as well. Solution must be moved over to the right so that the image is isolated as shown in the image below.
So it has to be one class for three paragraphs, and i cant use html, and it has to be three different images
homework?? try
:after
or
:before
and
background-image

ImageResizer image doesn't anchor when too small to resize

Been using ImageResizer quite effectively on my projects but just ran into an issue.
I have an img element that can have it's src change frequently but I always have the same dimensions of width and height to resize, along with the anchor=middleleft.
However, I don't want to upscale, so sometimes an image that is too small will be placed there and it won't anchor as desired.
Does anyone know a way to allow the anchor to still work when the image is too small to resize it? Or am I just going to have to have a fallback of css left alignment?
Try scale=canvas. This ensures the returned image is exactly the requested size, and adds padding as required.

CSS only thumbnail slider

I'm trying to make a thumbnail which on hover will move it's image (that's longer than the wrapper) all the way to the left using only CSS and using the img element and not a div with background-image.
The problem I have is that I don't know how could I find how much to move it given the fact that the images have different widths.
I did a demo where the left image moves correctly because I calculated how much it needs to be moved and the right image with the same CSS moving incorrectly.
It's not clear why you're restricting yourself to manipulating the img element alone and not exploring more usual background-image sprite-like hover event manipulations.
Take a look at this Codrops article and their demo's here (note there are 5 demo's in the menu).
The techniques offered don't produce the exact end result you're after, but they do include the structure for the type of events and manipulations you'd need to use.

CSS - button element rollover (not anchor element)

I know how to use background images and their position on an anchor element (using :hover). It's my understanding that ie6 doesn't support button:hover. How can I achieve this effect using only css?
IE6 only supports the :hover pseudo class on anchor elements. That means, just like everything else, you have to get a bit creative if you want to achieve this effect.
You'd possibly achieve a hack of this by starting with using conditional comments to include an IE6-specific style sheet for your page / site.
You could then either use a background image that looks the same as your button's background and set an anchor tag to use that background image with the image's correct fixed width, or (untested so not sure about this one) try wrapping the button in an anchor tag.

Resources