Guide to hiding a div along with its text on mobile devices

Do you want to display a circle and text only on desktop screens? Here's how you can achieve it:

<div class="circle">Text Here</div>

If you are able to hide the circle using media queries for desktop screens:

@media screen and (min-width: 600px) {
.circle{
//Circle design
}
}

The issue might be that the 'Text Here' within the Div is still visible. Do you know how to hide the text as well?

If anyone has a solution, please share! Thank you!

Answer №1

Display the element with class="circle" if the browser window is smaller than 600px

.circle {
  display: none;
}

@media screen and (max-width: 600px) {
  .circle {
    display: block;
  }
}
<div class="circle">Content Goes Here</div>

Answer №2

To hide the element when the screen width is less than 600px, simply insert display:none; inside your media query.

@media only screen and (max-width: 600px) {
    .circle {
       display:none;
   }
}

Instead of being displayed as a block, it will now be hidden when the screen width reaches 600px.

Answer №3

To achieve the desired outcome, follow these guidelines:

CSS:
 .circle{
visibility:hidden;
}

@media screen and (min-width: 600px){
.circle{
visibility:visible;
}

}

Alternatively, consider Option 2:

.circle{
display:none;
}

@media screen and (max-width: 600px){
.circle{
display:block;
}

Or you can explore Option 3:

@media screen and (max-width: 600px){
    .circle{
    display:none;
    }
}

For more details, visit the following Codepen URL - https://codepen.io/nagasai/pen/JNXypz

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

Correctly showcasing image text

I am currently experiencing difficulties with the orientation of elements in the react app. Specifically, I am trying to align the elements in a horizontal line. Any assistance with achieving this would be greatly appreciated. ...

Ways to make a div non-clickable disappear without using JavaScript - A guide on "lightboxing" a div

I would like the score's div to pop up as a lightbox when clicking on this link : <a href="#test">TEST</a> However, I do not want it to disappear when clicking on the div itself, only on the black background! Here are my attempts: < ...

Creating an autofocus feature using Angular 7 upon clicking a button

Within a table in my application, I have text boxes that are initially disabled and then enabled after clicking an edit button. Everything is working smoothly so far, but I am trying to set the autofocus to the first textbox of the first row when the edi ...

Even when autocomplete is disabled, Firefox continue to cache hidden input fields

I'm encountering an issue with a form that has the autocomplete attribute set to off. Within this form, there is a hidden input element (created using ASP.NET MVC's Html.HiddenFor() method): <input type="hidden" value="0" name="Status" id="S ...

Retrieve a specific HTML fragment from an HTML document using the Html Agility Pack

Is there a way to extract an html "fragment" using the html agility pack from a full html document? In this case, I define an html "fragment" as all content enclosed within the <body> tags. For instance: Input Sample: <html> <head> ...

Drop-down options disappear upon refreshing the page

Code snippet for sending value to server using AJAX in JavaScript In my script, the status value may vary for each vulnerable name. When selecting a status option and storing it in the database through AJAX, the selected value is lost after refreshing th ...

automatically adjusting the font size

There are 3 paragraphs of text on a page...I am looking to dynamically change the font size of these paragraphs every 3 seconds....is that feasible? Specifically, I want paragraph 1 to be initially displayed at 10px and paragraph 2 at 8px. Then, aft ...

The default setting for my bootstrap modal is displayed, not hidden

Is there a way to make my bootstrap model hidden by default and only visible when I click on a link? I'm new to web development and would appreciate any help. tst.html <!DOCTYPE html> <html lang="english"> <head> < ...

Having an issue with button onClick functionality not working in Javascript

Simple enough. I am struggling to get my button to generate the necessary input upon clicking. The fields should populate where the "household" class is located. I am limited to editing only Javascript and not HTML. Any suggestions? HTML: <ol ...

CSS guidelines specifically for when two classes are required to exist simultaneously

Is there a specific effect that can only be achieved when two classes are present simultaneously? For example: .positive{ color:#46a546; } .positive:after{ content: "\25b2"; } .negative{ color:#F00; } .arrow:after{ content: "\25bc"; ...

Automatically adjust height directive to fill up the remaining space

Is there a way to dynamically adjust the height of an element to fill the remaining space within its container? In my current layout, I have a fixed-height header (or menu) in pixels, a content area that may overflow the window height and require scroll b ...

Creating a separation line between divs using HTML and customized Bootstrap styling

I'm currently practicing with bootstrap and HTML, and I would appreciate it if you could take a look at the image I've included. In the image, I have successfully created and displayed a return flight. Moving forward, my goal is to enhance its ap ...

What is the best method to retrieve the color of an iframe within a PHP webpage?

I am trying to implement a color picker on my PHP web page that can extract colors from other websites when clicked. Users have the option to input the URL of the website they want to reference for color selection. I have tried opening the reference URL i ...

Is it possible to connect to standard Bluetooth devices using the Chrome Bluetooth API on a webpage? (excluding BLE)

Currently, I am conducting research on how to establish connections with Bluetooth devices through a web page. My goal is for the webpage to display a list of paired devices and be able to connect to them (specifically bluetooth printers). While I have com ...

CSS - Issue with aligning image captions

I created an HTML snippet that has the following structure: <div class="large-4 columns"> <div class="promo-box"> <a href="#"> <img src="/our-projec ...

Leveraging Angular for REST API Calls with Ajax

app.controller('AjaxController', function ($scope,$http){ $http.get('mc/rest/candidate/pddninc/list',{ params: { callback:'JSON_CALLBACK' } }). success(function (data, status, headers, config){ if(ang ...

Receiving a notification when attempting to log in with incorrect credentials

I am currently working on an Angular login page implementation using a username and password setup. When the user enters incorrect credentials, I want to display an alert message indicating the same. Here is the HTML code snippet for the form: <form [f ...

Issue with ng-pattern validation not functioning correctly on textarea in AngularJS

Attempting to validate a textarea that, if valid, will enable a specific button. Utilizing ngPattern for validation but encountering issues with implementation. Referencing the example code below: <div ng-app="test"> <form name="theForm" ng-contr ...

What is preventing my accordion from closing completely?

I'm currently working on creating FAQ questions in an accordion format. However, I've encountered an issue where adding padding around the answer section prevents the accordion from closing completely. Removing the padding solves the problem, but ...

What is the best way to turn off default CSS styling in KendoUI?

I am facing an issue in my application where I am using global CSS definitions for "INPUT", "SELECT", and other elements. The problem arises when I try to incorporate KendoUI widgets, as they override my default CSS styles. For instance, my CSS code looks ...