how i can fit text to an image with css


I have an image that I need to display a form in it,but when I add more tags and text it becomes messy :

enter image description here

here is my code :

    .box { 
    width: 650px;
    padding-right: 15px; /* the gap on the right edge of the image (not content padding) */ 
    margin: 20px auto; /* use to position the box */
    z-index: 10;
    position: absolute;
    top: 100px;
    left: 230px;

.box_head { 
    background-position: top right;
    margin-right: -15px; /* pull the right image over on top of border */
    padding-right: 40px; /* right-image-gap + right-inside padding */

.box_head h2 {
    background-position: top left;
    margin: 0; /* reset main site styles*/ 
    border: 0; /* ditto */
    padding: 25px 0 15px 40px; /* padding-left = image gap + interior padding ... no padding-right */ 
    height: auto !important; height: 1%; /* IE Holly Hack */

.box_body { 
    background-position: bottom left; 
    margin-right: 25px; /* interior-padding right */ 
    padding: 15px 0 15px 40px; /* mirror .cssbox_head right/left */
Problem courtesy of: Azzedine madi


I would suggest you use an image editor and then slice your images to the components.

After that, put the images in <img> tags and next to them are input controls. By doing this way, it would be easier to control the layout using CSS.

Solution courtesy of: Toan Nguyen


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.