Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the whole input text box full of the whole div

Tags:

html

css

input

The diagram below, the green is div and white area is a text box, I want to keep text box full of whole div

enter image description here

Who can help me? I will be very grateful.

like image 348
wanghao Avatar asked Aug 30 '25 18:08

wanghao


1 Answers

Set child width and height to 100%

Here is a live demo:

div{
  height:50px;
  width:300px;
  background-color:green;}

div input{width: 100%;height: 100%;}
<div><input type="text" name="test"></div>
like image 162
Luthando Ntsekwa Avatar answered Sep 02 '25 08:09

Luthando Ntsekwa