Jump to content

Tricky CSS positioning of Image + HTML Form

TechBlitZ

I have a HTML Form, and I have an Image..

 

I would like the form to sit on top of the image, so that the image is much larger and behind the form.

 

 

So far I have the image in the perfect position using the following

 

   .image { 
   position: relative; 
   width: 100%; 
}
 
I have the form and have styled it in CSS, it currently sits directly underneath my picture but I would like it to be splat bang in the centre of the image.
Any ideas how I can do this?
 
Thanks guys

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

I don't quite understand what you are trying to achieve.

How does the form sit directly underneath your picture? It looks like it's on top of it ( I'm talking about the z-index ).

gallery_3585_3625_199102.jpg

Do you just want to center the form?

@TechBlitZ follow your threads/topics.

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for the reply Nineshadow.

 

I mean currently the image sits under the form on the Y axis when viewed in my browser.

Attached is just a picture I mocked up in Photoshop.

 

I am looking to recreate what you see in that photoshop image, but in html/css

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for the reply Nineshadow.

 

I mean currently the image sits under the form on the Y axis when viewed in my browser.

Attached is just a picture I mocked up in Photoshop.

 

I am looking to recreate what you see in that photoshop image, but in html/css

can you send a picture of your design ? (as it is right now)

 

also. have you tried : background-image

 

as I see it you would have the background image with your actual image. then a div with the form in it (then set the background of the div in the css to be transparent)

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for the reply givingtnt,

 

Here's a pic of how it currently looks

Pic

 

Using the following html and css - https://jsfiddle.net/u655rvdb/

 

Thanks for the rapid replys, this is probably really simple

Link to comment
Share on other sites

Link to post
Share on other sites

You could try fiddling with Position: Absolute along with x: ?px, y: ?px, and z-index : ? to put the form exactly on the page.

That could get ugly though.

 

You might want instead a Float: Left to the image container and a Margin-Left : -?px on the form container.

This method will make the form be rendered next to the image container, rather than underneath it. And then with a negative left margin, which should be the same width as the form, it will be pulled over it.

 

It's been months since I've touched CSS layouts so this probably seems like a bit of a hack.

Granted, all CSS feels like a hack to me now.

 

Play around with those properties and you should be able to tweak things until the layout is right where you want it.

 

If all else fails, just put the form container inside the image container, and rather than rendering the image as its own element, you could attempt to set the background-image: src property on it so the outer container uses it as a background in the same way you would fill a div with a background-color.

 

Sometimes, the only way to learn CSS is trial and error. So keep at it.

---

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

@TechBlitZ Give the following CSS edits a go.

.bootstrap-frm {                        margin-left: 5%;            margin-right: auto;            max-width: 500px;            background: #FFF;            padding: 20px 30px 20px 30px;            font: 12px "Helvetica Neue", Helvetica, Arial, sans-serif;            color: #888;            text-shadow: 1px 1px 1px #FFF;            border: 1px solid #DDD;            border-radius: 5px;            -webkit-border-radius: 5px;            -moz-border-radius: 5px;        }.image {                position: absolute;            top: 0px;                left: 0px;            z-index: -1;        }
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×