Skip to content
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
84 changes: 84 additions & 0 deletions css/answers/jagrit-q12.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<html>

<head>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-157837769-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-157837769-1');
</script>

<title>
CSS | InterQues | Coding Ninjas
</title>

<link rel="shortcut icon" type="image/png" href="../../assets/favicon.png" />

<meta name="description" content="What is the purpose of the z-index and how is it used?">
</head>

<body>

<div>
<img src="../../assets/CN_logo.png" height='72px' alt="Coding Ninjas Logo">
</div>

<div>
<p>
<small>

<a href="../../index.html">Home</a>
&gt; <a href="../index.html">CSS Questions</a>
&gt; How will you bring a child element in the center of its parent element with the help of flexbox?

</small>

</p>
</div>


<div>
<div>
<h3>
Q : How will you bring a child element in the center of its parent element with the help of flexbox?
</h3>
</div>
<br>
<div>
<strong>Answer:</strong>
<p>
We can perform this task by first setting the display of the child element to flex. Then,We
will set the justify content and align-items property to center.
Make sure to apply height to the parent element otherwise the align-items property won't work.
<br>
Following is the code:
<br>
child{
<ul>
<li> display:flex</li>
<li> justify-content:center</li>
<li> align-items:center</li>
</ul>
}

</p>
</div>
</div>

<hr>

<div>
<h5>
Similar Questions
</h5>
<ul>

</ul>
</div>

</body>

</html>
7 changes: 7 additions & 0 deletions css/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ <h4>
</h4>
</a>
</li>
<li>
<a href="./answers/jagrit-q12.html">
<h4>
How will you bring a child element in the center of its parent element with the help of flexbox?
</h4>
</a>
</li>

</ol>

Expand Down