Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#106 - Fix the vertical alignment #107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions challenges/00106-easy-fix-the-vertical-alignment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
We have a row layout where there can be inputs with label or without label. The requirement is the if there is a input with labe, then all the inputs without label should have margin top equal to the height of label + space between label and margin.
11 changes: 11 additions & 0 deletions challenges/00106-easy-fix-the-vertical-alignment/info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
difficulty: easy
title: Fix the vertical alignment
type: question
template: vanilla
tags: css
author:
github: jsartisan
name: Pawan Kumar
avatar_url: https://avatars.githubusercontent.com/u/6636360?v=4
published_date: '2024-07-02'

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
```html index.html
<!doctype html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>

<body>
<div class="row">
<div class="field">
<label class="label">Name</label>
<div class="control">
<input class="input" type="text" placeholder="Text input" />
</div>
</div>
<div class="field">
<div class="control">
<input class="input" type="text" placeholder="Text input" />
</div>
</div>
</div>
</body>
</html>

```

```css styles.css
body {
font-family: sans-serif;
}

h1 {
font-size: 1.5rem;
}

.row {
display: flex;
gap: 1rem;
}

.field {
display: flex;
flex-direction: column;
gap: 0.5rem;
}

.field label {
height: 1cap;
font-size: 14px;
}

```

```js index.js
import "./styles.css";
```

```json package.json
{
"dependencies": {},
"main": "/index.js",
"devDependencies": {}
}
```