Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9045995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:31:04+00:00 2026-06-16T11:31:04+00:00

I am trying to display a page with different styles based on PC or

  • 0

I am trying to display a page with different styles based on PC or mobile.

My html,

<link media="only screen and (max-device-width: 780px)" href="iPhone.css" type="text/css" rel="stylesheet" />
<link href="pc.css" type="text/css" rel="stylesheet" />


 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <html>
 <head>
   <title>My first styled page</title>
 </head>

 <body>

 <!-- Site navigation menu -->
 <ul class="navbar">
    <li><a href="index.html">Home page</a></li>
    <li><a href="musings.html">Musings</a></li>
    <li><a href="town.html">My town</a></li>
    <li><a href="links.html">Links</a></li>
 </ul>

  <!-- Main content -->
 <h1>My first styled page</h1>

  <p>Welcome to my styled page!</p>

  <p>It lacks images, but at least it has style.
    And it has links, even if they don't go
     anywhere</p>

   <p>There should be more here, but I don't know
   what yet.</p>

    <!-- Sign and date the page, it's only polite! -->
    <address>Made 5 April 2004<br>
     by myself.</address>

   </body>
   </html>

my pc.css,

body {
  padding-left: 11em;
  font-family: Georgia, "Times New Roman",
        Times, serif;
  color: purple;
  background-color: #d8da3d }
ul.navbar {
  list-style-type: none;
  padding: 0;
  margin: 0;
  position: absolute;
  top: 2em;
  left: 1em;
  width: 9em }
h1 {
  font-family: Helvetica, Geneva, Arial,
        SunSans-Regular, sans-serif }
ul.navbar li {
  background: white;
  margin: 0.5em 0;
  padding: 0.3em;
  border-right: 1em solid black }
ul.navbar a {
  text-decoration: none }
a:link {
  color: blue }
a:visited {
  color: purple }
address {
  margin-top: 1em;
  padding-top: 1em;
  border-top: thin dotted }

and iPhone.css,

body {
  color: #FFFFFF;
  background-color: #000000 }
ul.navbar {
    display : none }

I tested this with chrome through Inspect Element and selected IPhone4 option, the menu links were not displayed as expected but the color and background-color styles in iPhone.css was not taking effect. It is shown as line crossed.

MobileCssResult

Please help me find where it goes wrong or provide a standard way to do this.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:31:06+00:00Added an answer on June 16, 2026 at 11:31 am

    Swap the two <link> elements. The generic stylesheets should go first, since their rules will get overridden by rules from more specific (device-specific) stylesheets that follow (if any).

    You should also place the <link> tags inside the <head> tag – otherwise your HTML is heavily malformed. There’s a lot of code in WebKit that tries to handle this as gracefully as possible, though…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display a page in NSIS to obtain two different values. I
I'm trying to display the page title (html title) on the default.aspx page of
I'm trying to get an html page to display an XML file formatted with
I was trying to display a static html page in an android app having
Hello I am trying to display two different html pages through the same UIViewController
I'm trying to display x number of different highchart graphs in a single page.
Im trying to display some files in a web page so the user can
I am trying to display multiple bing maps on the same page, with each
I'm trying to display a Google Map inside a drupal page. The map will
Now I'm trying to display the result of consuming a webservice from one page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.