Skip to content

Instantly share code, notes, and snippets.

@shreshthmohan
Last active August 27, 2021 14:52
Show Gist options
  • Save shreshthmohan/c4972e3f636c388a84b5534c89ab16ef to your computer and use it in GitHub Desktop.
Save shreshthmohan/c4972e3f636c388a84b5534c89ab16ef to your computer and use it in GitHub Desktop.
Full-width child
.full-width {
/* This display style is optional */
display: flex;
/* Note: - 20px and + 10px is done to avoid the div creating an extra x-scoll bar */
width: calc(100vw - 20px);
margin-left: calc((100% - 100vw) / 2 + 10px);
}
@shreshthmohan
Copy link
Author

How to use:

Simply add a div with a class of full-width and use this CSS snippet along with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment