1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<!doctype html> <html> <head> <style> .container { width: 400px; background: #ddd; } .text-input { width: 200px; /* 50% */ padding: 40px; /* 10% */ background: #fff; } </style> </head> <body> <div class="container"> <input type="text" class="text-input" /> </div> </body> </html>