What steps can I take to get a border functioning correctly on my website?

For my friend's birthday, I am designing a website that resembles a greeting card. The layout consists of text in the center and an image of a birthday cake. To give it a card-like feel, I want to create a border around it. Although I know how to adjust flexbox values, I'm hesitant to make changes on my own. Can someone guide me through the solution?

// JavaScript code for confetti animation goes here...
<!DOCTYPE html>
<html>
 <head>
    <meta charset="UTF-8"> 
    <title>&#127881;Happy Birthday&#127881;</title>
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
    <link rel="icon" type="image/x-icon" href="Images/favicon.ico">
    <link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet'>
    <style>
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
</style> 
</head> 
<body style="background-color:hsl(0, 0%, 0%); width: 100%; height: 100%;">
     <div class="animated pulse infinite" style="font-size: 90px; color:#06589c ; text-shadow: 0 0 2rem #06589c; font-family:'Raleway'; text-align: center; margin-top: 55px; font-weight: bold;">Happy Birthday Eshal!</div>
     <div class="Birthday Cake" style="text-align: center;">
     <img src="images/favicon.png" width="346.4px" height="310.8px" alt="Birthday Cake" style="text-shadow: 0 0 2rem white;">
     </div> 

     <script src="confetti.js"></script>
     <!-- Confetti  JS-->
     <script>

         // start

         const start = () => {
             setTimeout(function() {
                 confetti.start()
             }, 1000);
         };

         // Stop

         const stop = () => {
             setTimeout(function() {
                 confetti.stop()
             }, 5000);
         };

         start();
         stop();

     </script>

 </body>
 </html>

Answer №1

There are multiple ways to achieve this. One possible method is by directly adding it in the html code, although the specific border type you want is not specified.

html{
  border: 5px solid white;
  margin: 10px;
  min-height: calc(100vh - 20px);
}
body{
  overflow-x:hidden;
}

DEMO

var confetti = {
    maxCount: 150,      //set max confetti count
    speed: 2,           //set the particle animation speed
    frameInterval: 15,  //the confetti animation frame interval in milliseconds
    alpha: 1.0,         //the alpha opacity of the confetti (between 0 and 1, where 1 is opaque and 0 is invisible)
    gradient: false,    //whether to use gradients for the confetti particles
    start: null,        //call to start confetti animation (with optional timeout in milliseconds, and optional min and max random confetti count)
    stop: null,         //call to stop adding confetti
    toggle: null,       //call to start or stop the confetti animation depending on whether it's already running
    pause: null,        //call to freeze confetti animation
    resume: null,       //call to unfreeze confetti animation
    togglePause: null,  //call to toggle whether the confetti animation is paused
    remove: null,       //call to stop the confetti animation and remove all confetti immediately
    isPaused: null,     //call and returns true or false depending on whether the confetti animation is paused
    isRunning: null     //call and returns true or false depending on whether the animation is running
};

(function() {
    // Confetti functions here...
})();
html{
  border: 5px solid white;
  margin: 10px;
  min-height: calc(100vh - 20px);
}
body{
  overflow-x:hidden;
}
<!DOCTYPE html>
<html>
 <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Other HTML content -->
 </head>
 <body style="background-color:hsl(0, 0%, 0%); width: 100%; height: 100%;">
     <!-- Birthday wishes -->
     <div class="animated pulse infinite" style="font-size: 90px; color:#06589c ; text-shadow: 0 0 2rem #06589c; font-family:'Raleway'; text-align: center; margin-top: 55px; font-weight: bold;">Happy Birthday Eshal!</div>
     <div class="Birthday Cake" style="text-align: center;">
     <img src="images/favicon.png" width="346.4px" height="310.8px" alt="Birthday Cake" style="text-shadow: 0 0 2rem white;">
     </div;

     <script src="confetti.js"></script>
     <!-- Confetti related JS script -->
     <script>
         // Script for starting and stopping confetti
         const start = () => {
             setTimeout(function() {
                 confetti.start()
             }, 1000);
         };

         const stop = () => {
             setTimeout(function() {
                 confetti.stop()
             }, 5000);
         };
         
         start();
         stop();
     </script>
 </body>
 </html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Apply a vibrant red color to the border input (twig)

Hi everyone, I'm facing a little issue where my input is not changing to red color. I have tried to troubleshoot my code but can't seem to find the problem. Can anyone help? Here is my HTML code (Twig): {{ form_widget(form.value, {&apos ...

Can I use npm's jQuery in an old-school HTML format?

I am looking to incorporate jQuery into a project without having to rely on the website or CDN for downloading the library. As someone new to npm, I am curious to know if following these steps would be advisable or potentially problematic down the line. Wh ...

Exploring Hover Effects in Reactjs and Material UI

I've been working with reactjs and material ui, but I'm having trouble changing the background color of selected items in various components, like in the SelectField. <SelectField floatingLabelText="Choose a sport" value={this.state.val ...

Simulating jQuery/JS simulation has never been more exciting

Although I am still relatively new to jQuery and Javascript, I have a question about implementing tab functionality. I have created 4 clickable tabs using two functions - one that executes on click, and another that simulates the click every 5 seconds to c ...

Transforming numbers into arrays in JavaScript/TypeScript for Angular 7

What is the best way to convert the number 10 into an array in JavaScript? expected output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] OR How can I transform the number 10 into the number of items within an array using JavaScript? ...

Use jQuery to create rows within each div

Can someone assist me with the following issue? I have created an HTML grid where objects are displayed on the left side, and a row is shown for each object on the right side. I am looking to use jQuery to add 8 items in a row on the right side for each o ...

Shopping cart has encountered an issue with storing the data correctly

While I've managed to successfully integrate another service, the challenge now lies in implementing the logic for correctly generating cart items. My goal is to increment the quantity of items in the cart by one with each function call, but it seems ...

Executing an asynchronous action without linking promises to subsequent actions

Encountered a challenge while using componentWillReceiveProps with redux async action. Below is the code snippet along with an explanation: componentWillReceiveProps(nextProps) { if(nextProps.job.status === 'applied'){ this.showAppliedDial ...

Error: The property 'target' cannot be read

I'm seeking to enhance a value by pinpointing a specific element within a loop. <div *ngFor="let item of items; let i = index"> <ion-button (click)="increment(i)"> <ion-icon name="add"></ion ...

Include a new key into an array of objects within an asynchronous function

I am struggling with my async/await setup in an API route where I need to merge data from two sources into one object before returning it. The problem arises when I try to push data into a second array within the .then() block, as the array named clone end ...

applying different styles to various elements

As a newcomer to the world of jQuery, I am attempting to achieve the following goal: I have several instances of a div, and for each instance, I randomly assign a class from a predefined list in order to modify certain attributes. While this process is su ...

How to accurately determine the event.target for parent elements in JavaScript?

Firstly, I am utilizing pure vanilla javascript without any frameworks involved. My goal is to set up a click event listener on an element that is not yet present. In order to do so, I am following this approach (assuming parentElement is already availa ...

Retrieve the request body in Node.js Express server-side code in order to receive an array passed from the front end

I am facing an issue where I need to save a user's array to mongo. When the data passes through the bridge and reaches the posts, it appears as a strange object with string versions of its indices. I am attempting to convert it back into a normal arra ...

Can a link be stored in a table using PHP?

I need assistance in organizing a page with a sidebar containing about 20 links as the code appears messy. Is there a way to store all <a href=.... in a table, an array, or another method for better organization? If anyone could provide an example, it ...

Eliminating specific classes targeted by a jQuery attribute selector within the outcome of another jQuery attribute selector

I am facing a simple issue where I need to target all classes that end with a specific string on elements within a class ending with another specific string, and then remove those targeted classes. While the following code is close to what I want, it does ...

Troubleshooting problems with AngularJS placeholders on Internet Explorer 9

On my partial page, I've included a placeholder like this: <input name="name" type="text" placeholder="Enter name" ng-class="{'error':form.name.$invalid}" ng-model="Name" required /> I have also set up client side validation for the ...

Guide to positioning the layout inflater on the right side

I am facing an issue with the layout inflater where the inflated layout appears in the center of the page instead of the intended right corner placement. I have attempted to modify the gravity to right, but it did not resolve the problem. Below is a snipp ...

Tips for causing text to wrap to a new line when reaching the end of a div element

I am struggling with keeping a text inside a div from overflowing when it reaches the border of the div. I have tried various CSS properties like "word-break" and overflow, but haven't been able to find a solution. <div class="col-lg ...

Guide on using jest and fetch to properly validate the rendering of an APIgetMocking an API using jest and fetch for rendering verification

Despite conducting extensive research, I have been unable to find a concrete example that helps me understand this issue. What I am aiming for is to mock the API and test if it is rendering correctly. If someone could provide me with a code example using ...

Creating a unique JavaScript script that gradually adjusts the background color using the setTimeout() function

Is there a way to create a function that continuously changes the background color every 15 seconds by picking colors from an array that starts over once all colors have been used, without having the function run just one time? $(document).ready(() => ...