Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Center an input form in CSS

If you go to http://desimara.com and click the request button, and then scroll down to the file upload section of the forms, you can see that the input form for uploading files is not aligned in a symmetrical manner with everything else.

I tried fixing it using padding-left: 10%;, and that looked nice on the mobile view but as I spanned out it started to shift more to the right rather than staying put in the center.

I tried using pixels and that worked for the full screen but cut off text in the mobile view.

I tried using display: block and margin: auto, but that had no effect.

Can someone help?

Try giving the input#filefield a padding-left: 50px and see what you think.

1 Answer

I tried pixels as well. It isn't as clean as I'd like, but I'll take it.