How to add background to textarea – CSS Hack

This item was filled under [ CSS, Tutorials ]

Thanks for visiting! If you're new here, you may want to subscribe to my Rss Feed. This blog posts regular Internet news, updates for apps, security, ideas, hacks, quick fixes and everything about hi-tech. Go ahead, Subscribe to our Feed or Register for Free!

background-comment-wordpress

Playing with CSS you can create really pretty things. While I’m working a new theme for my blog that soon will be available, here is one of the CSS hacks that I’m using for comments text area. There are many ways of customizing your form elements. I will show you a way how to do this.

You can apply a background-color or background-image to any form element. Like the example i’m using  in a textarea adding a background (in the image above). Please be careful because sometimes it is not a good idea to change the background. The part of the text is very hard to read if you apply a image with lot of colors. Chose a white and black background and edit the opacity to 50% with any image editor.

CSS Code:


<style type="text/css">
<!–
textarea {
background-image: url(comment-bg.jpg);
background-position: bottom right;
}
–>
</style>

Copy and paste the above code to your CSS file. comment-bg.jpg is the name for the background, rename with your background name and background-position help to move the image bottom right (recommended ) or you can use top right and bottom left. Don’t use top left because will be very hard for the users to type any comment. 

HTML Code:

<form name="comments" method="post" action="">
<textarea name="textarea"></textarea>
</form>

Also you have to make an edit for the HTML code. Find textarea in you form and add name="textarea"

That’s all hope you enjoy this short CSS guide.

Popularity: 815 reading
If you like this entry, consider bookmarking or help us promote it. Thank You!
Interesting Articles:

Related post to "How to add background to textarea – CSS Hack"

  • Downloading Firefox 3.0.4

    Yesterday, Mozilla released a new update for Firefox. The version 3.0.4 now is available for download and update, where all known issues are...


  • User Agent for iPhone

    Maybe you are asking: What we need the User Agent for iPhone? In fact you don't need it a lot if you have an iPhone, if not I'm sure that you...


  • CSS Hack max width like image resize

    Recently I was fixing some CSS image alignments and the width for images. And the problem was with the big images that come out of content?! At...


  • Hide and protect your WP plug-ins and themes folder

    You are in a Wordpress site and want to know what plug-ins is using that site or what themes? This is very simply do to, just browse...


  • Remove Top bar In Blogger Blogs

    Here is a simply hack for blogger. A CSS hack how to remove the Navbar (topbar) in blogger. In some simply steps you will be able to have a...


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment