Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make child element width 30 precent of parent elements width using css?

Tags:

html

css

I have this div:

#edj{
 width:50%;
 border-style: solid;
border-width: 5px;
}
</style>
</head>
<body>
<div id = "edj">
<p><label>Faculty <input type="text" class = "k"> </label></p>
<p><label >Departmet <input type="text" class = "k"> </label>
</div>

I want to make textboxes width 30 percent of the div width.

How can I implement this using css code?

like image 317
Michael Avatar asked Feb 10 '23 04:02

Michael


1 Answers

This is an answer in it's simplest form, this will make input fields 30% of parents width.

input {
    width: 30%;   
}
like image 183
Addzy Avatar answered May 09 '23 18:05

Addzy