Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make fixed position row in bootstrap?

I have a table-like structure, where the first <div class="row">... behave as the header for the table.
I am trying to make it fixed, so when I scroll down the page, users can still see the columns headings.
I gave it position:fixed, which achieves that, but now, the width of the columns is trashed.

<div class="container">
            <div class="row" style="position:fixed;">
                <div class="col-md-1">id</div>
                <div class="col-md-3">L Name</div>
                <div class="col-md-1">M</div>
                <div class="col-md-2">F Name</div>
                <div class="col-md-3">Username</div>
                <div class="col-md-2">Phone</div>
            </div><!-- row -->
<!-- some data -->
            <div class="row">
                <div class="col-md-1">id</div>
                <div class="col-md-3">L Name</div>
                <div class="col-md-1">M</div>
                <div class="col-md-2">F Name</div>
                <div class="col-md-3">Username</div>
                <div class="col-md-2">Phone</div>
            </div><!-- row -->
</div>

I really needs this to work on Chrome/FF/Safary. IE is not a concerns

like image 750
Itay Moav -Malimovka Avatar asked Mar 06 '14 15:03

Itay Moav -Malimovka


People also ask

How do I center a row in Bootstrap?

Use the . align-items-center class in Bootstrap to align single rows of items in the center.

What is fixed top in Bootstrap?

Fixed top. Position an element at the top of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.

How do you fix fixed positions?

Set everything up as you would if you want to position: absolute inside a position: relative container, and then create a new fixed position div inside the div with position: absolute , but do not set its top and left properties. It will then be fixed wherever you want it, relative to the container.


1 Answers

Try it <div class="container" style="position: fixed"> EDIT: I create simple example at http://jsfiddle.net/ytJV7/2/

like image 177
user1809655 Avatar answered Sep 18 '22 01:09

user1809655