Click here to Skip to main content
15,441,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a freelancer and i am doing a website using c#.Can any one tell me how to make a division
in html visible only in desktop.God bless you.
Updated 12-Dec-13 18:55pm
Mitchell J. 13-Dec-13 0:53am    
What sort of division? A <div>? A <br />?
faizel s 13-Dec-13 0:55am     CRLF
BillWoodruff 13-Dec-13 1:25am    
div tags affect what is displayed in a browser: what's that got to do with the Desktop ?
faizel s 13-Dec-13 1:36am    
By Desktop i mean laptop browsers
What have you tried and where is the problem?

1 solution

There are many ways to detect, using javascript, whether a browser is mobile or not.
It's easier to detect a mobile browser - and thus indirectly desktop browsers - because if a browser is not mobile, it's desktop.

Check this link out. There are heaps of free code samples on the web.

Once you have a javascript function to detect whether a browser is mobile or not, you can then run some javascript on DOM load to hide the div with the background image.

Forexample, using jQuery:
$(document).ready(function () {
   //You can find heaps of functions that you can rename "isMobileBrowser()" through the link above.
   if (isMobileBrowser()) {
      //change bk_image to whatever the id of your div is.
      $('bk_image').css('display', 'none');

Hope this helps :-)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900