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 7911531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:16:59+00:00 2026-06-03T13:16:59+00:00

I want to create a baseline grid for my website that shows always baselines

  • 0

I want to create a baseline grid for my website that shows always baselines to the bottom of the page.

What I do is I create one initial baseline that is styled through css.

<figure id="lines">
    <div class='base-line bl1'></div>
</figure>

and then create new ones till I reach the bottom of the document.

<script type="text/javascript">
        $(document).ready(function() {
            var diff = Math.floor( $('body').height() / $('.base-line').height() );
            for ( var i = 1; i <= diff; i++ )
                $('#lines').append("<div class='base-line bl" + i + "'></div>");
        });
    </script>

However when I resize the page (e.g. decrease the height) there are baselines left over. And when I increase the height of the document dynamically (e.g. change some values with a media-query) the baselines don’t reach the bottom of the page.

Is it possible to right a resize-handler that adds and removes the baselines when resizing? I guess it’s rather unperformant if I delete all base-lines on each resize and draw all of them for each resize-state.

Any ideas on that?

  • 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-03T13:17:00+00:00Added an answer on June 3, 2026 at 1:17 pm

    Assuming this is the function that creates the base lines

    function addBaseLines(){
        $('#lines').clear();
        var diff = Math.floor( $('body').height() / $('.base-line').height() );
        for ( var i = 1; i <= diff; i++ ){
           append("<div class='base-line bl" + i + "'></div>");
        }
    }
    

    You could do this

    var timeout = null;
    
    $(window).resize(function(){
        if (timeout!=null){
            clearTimeout(timeout);
        }
        timeout = setTimeout( addBaseLines, 1000); // only do when the user is "done" 
    
    });
    

    See in JSFiddle

    Performance is not terrible if you use the timeout…

    To improve performance, just removes the ones out of sight, but I think it’s not that critical

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

Sidebar

Related Questions

I want create a cache so that when an item doesn't exist, only one
I want create constructor that will take one or more integers and save it
We want to create a widget platform for a particular website. I couldn't find
I want to create a stored procedure (on SQL Server 2005) that fetches a
I want create a tarball that when extracted the file(s) will be placed at
I want create texture atlas(matrix of images) from multiple images.Is their any applescript that
I want create a button option that takes the entire datalist and converts it
i want create one simple windows form ,it just contain Editcontrol(textbox),Static Edit(label),Button (Name of
i want create a counter that retrieve the number of month, day, hour, minute
I want create a excel with Apache POI in java and I must insert

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.