• I have a fixed sidebar:

    #sidebar {
        background-color: #eaeaea;
        width: 18.5vw;
        height: 100vh;
        position: fixed;
        align-items: stretch;
    }

    Since it’s position: fixed; it is not in the natural flow, meaning that if I don’t give the main content a width relative to the sidebar and float/position it right, then the main content will appear in front of/behind it, like this: (https://picpaste.com/pics/screenshot-PiBDmenN.1490873729.png).

    This is hard to do with this content as it’s a WordPress plugin template that contains more templates which contain more templates and no actual content, and any containers I try to add to the main template don’t show up (in the case of this particular page, at least). It did work with a different page and template: (https://picpaste.com/pics/screenshot1-BPi0QsIX.1490873805.png).

    My question is if it’s possible to fix the sidebar in position without it leaving the natural flow, so that i don’t have to give all the main content a relative width – the main content isn’t always grouped together and I end up having to target many individual elements to do this which could be problematic in the future if new elements are introduced.

    Here is the beginning of the code of the template that doesn’t see the container (called .match-wrapper):

    <?php
    /**
     * The Template for displaying job details
     *
     * Override this template by copying it to yourtheme/simple_job_board/single-jobpost.php
     *
     * @author      PressTigers
     * @package     Simple_Job_Board
     * @subpackage  Simple_Job_Board/Templates
     * @version     1.1.0
     * @since       2.2.0
     * @since       2.2.3   Enqueued Front Styles & Revised the HTML structure.
     * @since       2.2.4   Enqueued Front end Scripts.
     * @since       2.3.0   Added "sjb_archive_template" filter.
     */
    get_header(); ?>
    
    <img src = '<?php bloginfo('template_directory'); ?>/images/nieuwspagina-header.png' class="not-front-page-header" />
    
    <div class="match-wrapper">
    
    <?php
    ob_start();
    global $post;
    
    /**
     * Enqueue Frontend Scripts.
     * 
     * @since   2.2.4
     */
    do_action('sjb_enqueue_scripts');
    
    /*code continues....

    Many thanks.

    • This topic was modified 7 years, 8 months ago by culletron.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry, no. If it were part of the flow, when it was repositioned it would leave a hole where it should have been. It sounds like the plugin layout is fundamentally flawed. Normally, setting the outer container width to allow for the sidebar, say width: 81.5vw would cause all inner content to adjust accordingly. Assuming the page was designed responsively, which all modern webpages should be.

    Wouldn’t the same problem exist with any sidebar, fixed or not? It sounds like the plugin needs remedial CSS work in general. Wouldn’t any added elements have standardized classes so the same CSS would apply to new elements? It sounds from your description that new elements would need their own new CSS!

    It sounds like something the plugin devs should be addressing. I get that you’re stuck in the middle and just need it to work, it’s just an observation.

Viewing 1 replies (of 1 total)
  • The topic ‘Is it possible to position:fixed the sidebar and remain in the natural flow?’ is closed to new replies.