Personalized button utilizing Bootstrap 4

Seeking assistance to create a button with a 3D effect. I want to mimic the appearance of this button: https://i.sstatic.net/9sFs5.png

Currently using Bootstrap to generate a button using this code:

<button type="button" class="btn btn-primary">Game</button>

Anyone knowledgeable in creating 3D effects willing to offer guidance?

Answer №1

In my opinion, this CSS code is the best solution available. (It's worth mentioning that Bootstrap4 is used in the following script)

<style type="text/css">
.my-style {
  border-radius: 8px;
  width: 120px;
  box-shadow: inset 0px 3px 1px 0px rgba(83,154,197,1),
              inset 3px 0px 1px 0px rgba(83,154,197,0.4),
              inset -0px -3px 1px 0px rgba(0,73,140,0.8),
              inset -3px 0px 1px 0px rgba(0,73,140,0.3);
}
.my-style:hover {
  box-shadow: inset 0px 3px 1px 0px rgba(83,154,197,0.5),
              inset 3px 0px 1px 0px rgba(83,154,197,0.2),
              inset 0px -3px 1px 0px rgba(0,73,140,1),
              inset -3px 0px 1px 0px rgba(0,73,140,0.5);
}
</style>
<button type="button" class="btn btn-primary my-style">GAME</button>

Another option is to use the image itself as a button: Embed image in a <button> element

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

include the parent DOM element's class into its child element

I am looking to include the class of the parent DOM node in its child DOM element. For instance, let's consider the following structure: <ol class="test1"> <li> <li> <ol> I want the child ol elemen ...

Obtaining the Author's ID on Blogger

Is there a way to extract the author's ID on Google's blogger.com platform? I'm familiar with how to obtain the post ID using data:post.id, but what about the author's ID? ...

The registration page in PHP is malfunctioning, and the reason remains a mystery to me

Having trouble with my register page submit button. Any help is appreciated. Below is the structure of my SQL table: CREATE TABLE `USERS` ( `id` int(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, `username` varchar(50) NOT NULL, `password` varchar(50) N ...

Why isn't it working? Looking for a script that adds a class when the element is empty?

I have a script that should add the class "leftmax" to the li element with id "spect" when the div element with id "tab2" is empty, but it doesn't seem to be working. Can someone provide some assistance? <script type="text/javascript"> $(funct ...

This JavaScript function assigns a value to an input field in a form, only to have the value vanish soon after

I'm attempting to create a dynamic database search using ajax with a form input field. Currently, I am able to choose a text from the suggested list and trigger the "livesearchSelect" event, which sets the value of the input field. However, the set va ...

Ways to conceal components upon clicking a different element

Struggling to make this jQuery function properly. I have a form with all fields contained in a div.form-group. The subscribe button is identified by the id subscribe. I'm aiming to hide the form fields when clicked, but my JavaScript doesn't see ...

What is the best way to incorporate regular, light, and bold fonts into your project using links from Google Fonts

I am looking for three specific styles of Ubuntu font without having to download them. To access these fonts, I inserted this link in the <link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,700" rel="stylesheet"> According to Google& ...

Mandate that users select from the available place autocomplete suggestions exclusively

I have integrated the "Places" Google API to enable address autocomplete in an input field on my website. However, since the service is limited to a specific area, I have implemented an autocomplete filter. The issue I'm facing is that users are stil ...

Elements are failing to respond to the padding and margin adjustments in my CSS styling

I've been experimenting with creating a visually appealing div that serves as the centerpiece of a website. Imagine it resembling a standard "news" link. The width set at 80%, an image aligned to the left with a border, a headline detailing the lates ...

The functionality of both P and H1 tags seems to be malfunctioning

Can someone help me with changing the font family and size of my paragraphs and headings (p and h1)? Any assistance would be greatly appreciated. Feel free to review my code for any other errors as it has been a while since I last coded. html, body { ma ...

Ways to control the number of boxes that are checked

I am currently working on a script to restrict the number of checkboxes that can be checked, but I am encountering an issue where the script is disabling all checkboxes on the page. Is there a way to only disable a specific checkbox within a certain div? ...

Establish the height of the root to be the same as the height

As a newcomer to HTML and CSS, I am struggling with setting the background color of my root div on a webpage. My code is quite complex, but let me simplify the issue for you by providing a sample problem below. <style> #background{ background-c ...

Encountering a ModuleBuildError while setting up Tailwind CSS in Laravel 8

I am currently learning Laravel version 8 and encountered an issue while trying to install Tailwind CSS using the npm command. npm install tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9 Here is a detai ...

Reading settings from web.config file in an HTML page

Currently working with ASP.NET 3.5 web forms. I've recently saved the path of my website in the web.config file under the key "CommonPath". I have a basic static HTML page that I would like to utilize this key on. Any suggestions on how to achieve ...

broadcast a video file from a Node.js server to multiple HTML5 clients at the same time

After researching online, I have been looking for a way to simultaneously stream a video.mp4 to multiple html5 clients. Despite reading various tutorials, I haven't found the ideal solution using nodejs. Do you have any suggestions or alternative met ...

Using AngularJS filter to refine results based on specific values within JSON data

I am looking to implement a custom free text filter with just one input field in a table. The standard filter currently applies to all values, but I specifically need it to focus on col1 and col2 from this JSON array: myJsonArray = [{col1: "xxx", col2: "y ...

Why is AJAX failing to execute PHP file from JavaScript?

The Issue: Hello, I have confirmed that my PHP file is functioning properly. However, the AJAX code connected to my JavaScript function seems to be malfunctioning. Even though the function is triggered, nothing happens as expected. The Script: Check o ...

Animate custom scrollbars with jQuery for a unique browsing experience

I am experimenting with creating a scrolling animation using mCustomScrollbar Currently, I have managed to obtain the current scrollTop and animate it to a specific height using the code below: $("#content").mCustomScrollbar({ scrollButtons:{ ...

When verifying the source, the empty() function does not eliminate any HTML content

I am facing an issue with an AJAX call that retrieves data from a PHP file. I am attempting to remove existing HTML content and replace it with the data fetched from the PHP file. To clear the content, I am using the following: $('#due-tasks-content& ...

Prevent Bootstrap 4 from causing content to shift downwards when collapsing

Currently, I am utilizing Bootstrap 4 Collapse and it is functioning flawlessly. However, I am interested in making a slight adjustment. Is there a method to prevent the collapse from pushing down the content below it and instead have it overlap? If this i ...