- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Input fields with dynamic width</title>
<link href="course.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body class="subtle">
<div class="card">
<h1 class="card-title">Input fields with dynamic width</h1>
<div class="input-container">
<input class="input">
<button class="add-on icon-start">Start</button>
<a href="#more">More</a>
</div>
<div class="input-container">
<span class="add-on">Amount</span>
<input class="input">
</div>
<div class="input-container">
<span class="add-on icon-search">Search</span>
<input class="input">
<button class="add-on button">Go</button>
</div>
</div>
</body>
</html>
CSS
.input-container {
margin: 30px 0;
width: 450px;
outline: 2px dashed rgba(0, 128, 0, 0.2);
outline-offset: 5px;
}
.add-on {
display: inline-block;
box-sizing: border-box;
padding: 8px 12px;
min-width: 40px;
min-height: 36px;
border: 2px solid #cccccc;
background-color: #eeeeee;
color: #666666;
vertical-align: top;
}
.input {
padding: 8px 12px;
border: 2px solid #cccccc;
}
.input:not(:first-child) {
border-left: 0;
}
.input:not(:last-child) {
border-right: 0;
}
.input-container a {
margin: 0 10px;
color: #666666;
font-size: 12px;
line-height: 36px;
}
You’ve gone to a different page
Goalscompleted
0
- Assign a flexbox layout to the
.input-container
block, - and assign a growth factor of
1
for.input
. - And reduce the width of
.input-container
to200px
, - assign a zero shrinkage factor to
.add-on
, - and assign a minimum width of
50px
to.input
.
Comments