Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html how to display something on mobile and another on desktop

<#-- Display only on destop and tablet -->
<div class="screenDisplay">
  <p>This is only displayed on desktop and tabled</p>
</div>
  
<#-- Display only on mobile -->
<div class="mobileDisplay">
  <p>This is only displayed if on mobile</p>
</div>
  
<#-- On the CSS file we use -->
  // ONLY FOR MOBILE
@media (max-width: 767px) {
	.screenDisplay{
		display:none
	}
}

// ONLY FOR DESKTOP AND TABLET
@media only screen and (min-width: 768px) {
  .mobileDisplay{
		display:none
	}
 }
Comment

PREVIOUS NEXT
Code Example
Html :: adding image in html 
Html :: meta redirect header 
Html :: flexbox bootstrap 4 
Html :: script src tag in html 
Html :: javascript generate pdf from div content jquery 
Html :: bootstrap align right 
Html :: fontawesome 
Html :: embed string html angular 
Html :: auto update copyright year javascript 
Html :: onclick button href 
Html :: handlebars teamplate script tag 
Html :: font awesome src 
Html :: less than symbol html 
Html :: html canvas clear shadow 
Html :: html links 
Html :: mdb input bg 
Html :: add fav icon to website 
Html :: og html 
Html :: tailwind push footer always to bottom of screen 
Html :: html insert remote image 
Html :: linked image html 
Html :: bootstrap 5 change size of icon 
Html :: econnreset 127.0.0.1 
Html :: input decimal html 
Html :: pass text from input field to javascript function 
Html :: how to display a link in html 
Html :: BootStrap 4.6,BootStrap 5.2 CDN Css & JS & Bundle 
Html :: vue submit reloads page 
Html :: facebook seo meta tags 
Html :: mat tab badge 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =