Is it possible to position:fixed the sidebar and remain in the natural flow?
-
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.
- The topic ‘Is it possible to position:fixed the sidebar and remain in the natural flow?’ is closed to new replies.