Search code examples
colorstextboxcenterpermanentinsets

Centering Text Inside A Colored Inset Border Textbox


I'm new to html & css, and I'm trying to have non-editable (permanent) centered text inside a colored inset border textbox. I can't seem to get permanent text within the textbox. Any text I type seems to go outside of the textbox.The 9px inset part isn't working as well. I have attatched a picture of what I'm trying to do. Here's my code that I'm using: html:

Page <input size="3" name="uid"> of 1

css: INPUT,SELECT,TEXTAREA
{background-color: black; color: white;

border:9px inset #2121; border-color: #444;}

INPUT,SELECT { font-size: x-small; }

Picture: https://i.sstatic.net/w2QeO.png Here's some code that I found that makes text appear un-editable. I'm unsure how to change the border color & size in html though. http://www.w3schools.com/css/tryit.asp?filename=trycss_border-style


Solution

  • Try adding text-align: center; to your style for the input