How to Create Border Gradient With
Border Radius in HTML & CSS
Video Tutorial for Border gradient with Border radius
Border gradient with Border radius [Source Codes]
To Border gradient with Border radius with HTML and CSS, follow the given steps line by line:
Create a folder. You can name this folder whatever you want, and inside this folder, create the mentioned files.
Create an index.html file. The file name must be index and its extension .html
Create a style.css file. The file name must be style and its extension .css
Once you create these files, paste the given codes into the specified files. If you don’t want to do these then scroll down and download the source code by clicking download button.
First, paste the following codes into your index.html file
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Border Gradient With Border Radius</title>
- <!-- Stylesheet -->
- <link rel="stylesheet" href="style.css" />
- </head>
- <body>
- <div class="box"></div>
- </body>
- </html>
-
Now paste the following codes into your style.css file
- body {
- min-height: 100vh;
- align-items: center;
- justify-content: center;
- background:#E4F2FD ;
- }
- .box {
- height: 20em;
- width: 20em;
- background-color: #E4F2FD;
- position: absolute;
- margin: auto;
- border-radius: 50%;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
- }
- .box:before {
- position: absolute;
- content: "";
- height: 120%;
- width: 120%;
- background-image: -webkit-linear-gradient(to right, #4070f4,#65BBB1, #4a00e0);
- background-image: linear-gradient(to right, #65BBB1, #4070f4,#4a00e0,#216671);
- left: -10%;
- top: -10%;
- z-index: -1;
- border-radius: 50%;
- }
-
If you face any difficulties while creating your Border gradient with Border radius or your code is not working as expected, you can download the source code files by clicking on the download button.