Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Display grid</title>
- <style>
- .parent {
- display: grid;
- place-items: center;
- border: 5px solid red;
- width: 600px;
- height: 100px;
- float: right;
- }
- .child {
- text-align: center;
- width: 400px;
- background-color: red;
- color: white;
- font-family: verdana;
- padding: 5px 0;
- }
- a {
- position: absolute;
- text-decoration: none;
- font-size: 20px;
- font-family: verdana;
- color: white;
- background-color: red;
- padding: 5px 20px;
- line-height: 50px;
- }
- </style>
- </head>
- <body>
- <a href='https://www.youtube.com/channel/UCI875fP1d6RdkZje7R-9ieQ'>YouTube Channel</a>
- <div class='parent'>
- <p class='child'>I am inside a DIV with "float right". But I'm centered with "display grid".</p>
- </div>
- </body>
- </htm>
Add Comment
Please, Sign In to add comment