Topic: styling ruby text fields etc

hi all ,


i have tried to style a text box with a border in css which ruby created but when i view it the border doesnt seem to line up with the textbox properly as in the textbox is slightly to the right of the border . to me it looks like two seperate boxes

but i used the id="box" then created and style in my css file #box { border: 1px solid #999999; }


any help will be great

thanks

Re: styling ruby text fields etc

Perhaps there is a margin or padding being inherited from the DOM objects parent.

If you're on a Mac get CSSEdit and utilize the X-Ray function.

If you're on another machine I believe there is a plug-in called Firebug which does something similar. It allows you to visually see the CSS elements.

"If I'd asked my customers what they wanted, they'd have said a faster horse." - Henry Ford

Re: styling ruby text fields etc

Well first of all, calling it box probably doesn't make much sense to rails. Just use 'textarea' since that's what it is.

But in all honestly, I wouldn't even do that. I would just create a new div, put the textarea in that div. This way you can specify where on the page you want it and it's dimensions. If you're looking for consistency, definitely set it's dimensions so the textarea cannot be resized.

Here is an example of a fixed textarea. It still is set so that it can scroll so you still have infinite lines...

textarea {
    width:300px;
    min-width:300px;
    max-width:300px;
    height:200px;
    min-height:200px;
    max-height:200px;
}

but if you want to put it somewhere on the page and set a border and all that, you should probably create a div, with it's location, border and any other css. Then create a class, like the code above, and put that specifically to the text area. I would do this so the CSS of the div doesn't confuse the CSS for the textarea because that's happened before and textareas are a bitch about dimensions.

- Ben