Tips for showing button tags on mobile devices

On my blog, I have customized the button tag in two different ways. Here is the code for both:

    .button1 {
border: 2px solid rgb(0, 0, 0);
box-sizing: inherit; 
background-color: #ffffff; 
margin-right: 1.7px; 
color: black; 
font-size: 18px;
font-weight: 980;
padding: 6px 32px;
text-align: center;
transition: all 0.3s ease-in-out 0s;
width: 96.6px;
text-decoration: none;
line-height: 22px; 
font-size: 16px;
font-family: domine;
display: inline-table;
}
.button2 { 
border: 2px solid rgb(255, 87, 51);
background-color: #FF5733;
box-sizing: inherit;
margin-right: 1.7px; 
color: white; 
font-size: 18px;
font-weight: 980;
padding: 6px 42px;
text-align: center;
transition: all 0.3s ease-in-out 0s;
width: 96.6px;
text-decoration: none;
line-height: 22px; 
font-size: 16px;
font-family: domine;
display: inline-table;}
.button2:hover {
  background-color: #FF5733;
  color: #000000;}

However, the customization I applied is not showing up on mobile view, it defaults back to the original styling. How can I ensure that these customizations are visible on mobile devices? Please assist me with a solution.

For reference, here's the code snippet I used:

  @media screen and (max-width: 390px) {
.button2 { padding: 6px 32px;width: 84.6px;font-size: 16px;display: inline-table;
}
@media screen and (max-width: 390px) {
  .button1 { width: 76.6px;}
}}

I attempted to implement these CSS changes in the blogger blog settings, however, they seem to have no effect on the mobile view. Can you please guide me on where I might be going wrong or offer suggestions on how to fix this issue?

Answer №1

Don't overlook this crucial detail: always place the @media code below your other codes to ensure it works correctly. Also, if you have identical styles for @media screen and (max-width: 390px), consider consolidating them within the same @media query like so:

@media screen and (max-width: 390px) {
   .button2 { padding: 6px 32px;width: 84.6px;font-size: 16px;display: inline-table;
    }
   .button1 { width: 76.6px;}
}

Remember to insert this CSS using the edit HTML feature of your template for optimal results.

Answer №2

There are several common reasons for encountering this issue:

  1. If your server has a cache enabled, try clearing the cache from your browser.
  2. Ensure that any @media code is placed after your primary .button2 and .button1 codes.
  3. Make sure to include the @media code in the same file as your main button codes.

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

Is it possible to incorporate custom HTML tags into Jekyll?

Is it possible to have Jekyll generate template pages that preserve HTML::Template's tags for a Perl script utilizing the HTML::Template Perl module? I'd like Jekyll to ignore these tags completely. For instance: <tr> <td&g ...

Can Socket.IO link to a source tag that doesn't actually exist?

As I was following the 'Get started thing' tutorial on Socket.IO, I encountered a step that required me to add the socket.io.js script to my HTML page. The instruction provided was: /socket.io/socket.io.js However, when I checked my folders, I ...

Struggling to get image properly aligned using touch gestures

Currently, I am struggling with the task of centering my image based on the touch input that will drag it. For example, if the user touches the top right corner of the image, I want the image to automatically move so that its center aligns with that touch ...

Formatting won't assist in aligning Facebook button

I am currently working on a page that includes a div with a Facebook recommend button. In order to style the Facebook code, I enclosed it with this formatting: <div style="align:center"> <div id="fb-root"></div> <script src=" ...

Optimizing HTML5 metatags and styles for a mobile application

As a C++ developer who has recently delved into using HTML5 for my mobile applications, I am in need of guidance when it comes to fine-tuning my meta tags. While I do have some knowledge in web programming, there are still gaps in my understanding. I am s ...

CSS will only be visible if it is enclosed within the <style> tag

While creating a view, I noticed that my CSS is not being displayed unless it's placed inside a <style> tag. I've tried using !important without success, as well as utilizing the selector .container-fluid > .row > .d-flex > .out_pr ...

What methods can be used to modify the appearance of the cursor depending on its position?

Is there a way to change the cursor to a left arrow when on the left half of the screen and switch it to a right arrow when on the right half, using JavaScript? I am trying to achieve something similar to what is shown on this website. I attempted to acco ...

Showing no background color until the user lifts their finger

I am currently in the process of developing a website. The navigation on the website starts off as transparent (background: transparent) when opened, but as soon as you start scrolling, it should transition to a colorful state with shades like grey, midnig ...

Error in jQuery: Null property causing TypeError when reading 'text'

Issue: I have a modal form that is loaded via an ajax call. Inside the modal, there is a span element containing an email address. I am trying to capture the value of this span element using JavaScript. Currently, I have a button click event that triggers ...

The timer is malfunctioning

I am new to JavaScript and looking to create a simple countdown. I came across this script: http://codepen.io/scottobrien/pen/Fvawk However, when I try to customize it with my own settings, nothing seems to happen. Thank you for any assistance! Below is ...

JavaScript is not designed to run a second time

Currently, I have a script set up using $(document).ready(). It works perfectly upon initial loading. However, I also need this script to execute whenever the user changes an HTML select control. Ideally, upon page load, I want the filter and sort functio ...

Switching over to a stored procedure

I have been using a query string for the jQuery Autocomplete plugin, but I think it would be better to switch to a stored procedure. However, when I tried to do so, it didn't work. Can anyone provide guidance on how to convert my code? Original ASHX ...

The previous link is still present in the current URL

Having some trouble with my button code here. I'm new to HTML and I have a button that references another HTML file using a parameter. <a class="btn btn-primary" role="button" href="reto_resultado/{{ clave_primaria }}">Check</a> The issu ...

"Fixing the Vertical Order of Divs with Jquery: A Step-by-

Before I completely lose my mind, I need some help with a coding issue. Right now, I have two initial divs displayed. The user should be able to add these divs below the original ones as many times as they want, or remove them if needed. I've been att ...

Dynamic style binding with the ability to choose from four unique colors

I am looking to customize my table design similar to the image here: https://i.sstatic.net/ylMCN.png I have tried using the code below, but it only works for 2 colors. <table *ngFor="let item of notif"> <tr class="cell" [style.border-color]= ...

Rearrange the first division to the second division in a responsive manner

.box { display: block; width: 200px; height: 200px; padding: 20px; background: black; } .class1 { position: relative; color: red; } .class2 { position: relative; color: red; } <div class="box"> <div class="class1"> Th ...

What is the best way to move the navigation bar to the top after selecting a menu option?

I am utilizing bootstrap 3. <body> <div id="site-wrapper"> <div class="nav-wrapper"> <nav class="nav-bar" id="nav" role="navigation"> <ul class="primary-nav"> <li><a hr ...

How can progress bars be animated using CSS or JavaScript?

I am currently working on creating a progress bar animation, but I'm unsure whether to use CSS or JS. Can anyone provide insight on how this effect was achieved here? I am hoping to replicate it. Does anyone know if this is the code they used? I&apos ...

Minimizing the amount of code written

I have the following CSS code: /* unvisited link */ a.underl:link { color: #000000; text-decoration: none; } /* visited link */ a.underl:visited { color: #000000; text-decoration: none; } /* mouse over link */ a.underl:hover { color: ...

Can Angular be used to send form data to an external URL?

Let's take a look at an example with some code: <form method="post" action="URL"> <input type="text" name="first name" /> <input type="text" name="last name"/> <input type="submit" value="Submit" name="submit"/> < ...