-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
21 lines (20 loc) · 980 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Creating full width (100% ) container inside fixed width container.</title>
</head>
<body>
<h1 itemprop="headline">Creating full width (100% ) container inside fixed width container.</h1>
<div itemprop="articleBody">
<p>Some times we need to add a full width containers (which spans 100% of window) inside a container which has a fixed width and aligned center.</p>
<p>Following code helps to achieve the layout.</p>
<p>HTML</p>
<pre> <div class="container" style="width: 750px; margin: 0 auto;"> <div class="row-full"> --- Full width container --- </div> </div></pre>
<p>CSS </p>
<pre> .row-full{ width: 100vw; position: relative; margin-left: -50vw; height: 100px; margin-top: 100px; left: 50%; }</pre>
<p>How it works:</p>
<p>Css units vw (viewport width) is used here. IE9 above has support for vw & vh css units.</p>
</div>
</body>
</html>