i have this css to highlight input when they are in focus:
input:focus, textarea:focus{
background-color: #FFFF99;
border-width: 1px;
border-style:solid;
border-color:Black;
}
i just noticed that when i click on a textbox it shrinks by a very small but noticable amount. Is there any reason why the css above would change the width & height of a textbox when i have it in focus?
i am using firefox 3.16
it shrinks because the default borders of a
textareainputare 2-3px and you’re only overriding them to 1px in the focus stateit won’t shrink if you override the default borders to be the same width e.g.:
Update
to retain original dimensions without recalculating for borders this appears to work: