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

  • SEARCH
  • Home
  • 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 7715977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:31:21+00:00 2026-06-01T02:31:21+00:00

I am building a website which I would like to behave responsively using CSS

  • 0

I am building a website which I would like to behave responsively using CSS Media Queries.
I am also using Knockout-js to template my UI on the client – it really is quick nice to use.

What I am discovering, is that I need to, for example, render some UI which I define in a knockout-js template… this results in some DIVs and SPANs which render text for each ‘list item’.
When the user shrinks the screen down, the layout responds through Media Queries to ‘simplify’ the user interface – dropping more detailed information to make space for the most important stuff.

I know that I could just use css to ‘group’ my labels into ‘levels of verbosity’, and then use media queries to turn off the ‘higher levels of verbosity’ as the screen real-estate is reduced – this would effectively make certain HTML elements invisible.

However – my templates get very complicated, very quickly – because simply turning off a div may not be enough. It seems to me, that it would make more sense that I could define a template, which would include a css-media-query ‘rule’, so as the user changed the browser size, the templates were actually swapped. This would lead to much cleaner HTML templates, and less complicated CSS.

So, my question is – has anyone considered this problem, perhaps solved it through some best practice – perhaps I’m missing some functionality in KnockoutJs that would take care of this for me?

Thanks SO!

  • 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-01T02:31:22+00:00Added an answer on June 1, 2026 at 2:31 am

    At best, I think the way to go here would be to keep an eye out on $(window).resize (if you’re using jQuery) and check the dimensions of the page on initial load and set some base observable that tells you which responsive mode you should be in.

    Something like:

    var layoutType = ko.observable('normal');
    
    $(window).resize(function() {
      if ($(window).width() > 900)
        layoutType('normal')
      else if ($(window).width() > 500)
        layoutType('compact')
      else
        layoutType('compressed')
    });
    
    $(document).ready(function() {
      $(window).resize()
    })
    

    Then you can create computed observables based on that base observable that can take appropriate action based on the layout type.

    You can also watch for some CSS marker, e.g. some element that will disappear in smaller sizes.

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

Sidebar

Related Questions

I'm building a website that will require user registration and logon. I would like
I'm building a Content Management website which will also include other features. When an
I am just building website for our client. It is simple page which lists
I have a website for which I am building in categories which would work
I'm building a website which will show comics. I'd like to store each image
Good Evening, I'm building a website which will will look something like this: So
I'm building a small-scale website (a personal one) in which each page would have
I am building a website and would not like to reconfigure the website from
I am building a website which loads some collada objects for each area. But
I'm building a public website which has its own domain name with pop/smtp mail

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.