CSS positioning in _Layout.cshtml

Asked

Viewed 61 times

1

I’m having trouble positioning with the @RenderBody(), I am unable to adjust according to the side menu, I would like a solution, thank you.

Imagem

<div class="nav-side-menu">
    <div class="brand">Life Players</div>
    <i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>

    <div class="menu-list">

        <ul id="menu-content" class="menu-content collapse out">
            <li>
                <a href="#">
                    <i class="fa fa-dashboard fa-lg"></i> Dashboard
                </a>
            </li>

            <li data-toggle="collapse" data-target="#products" class="collapsed active">
                <a href="#"><i class="fa fa-gift fa-lg"></i> UI Elements <span class="arrow"></span></a>
            </li>
            <ul class="sub-menu collapse" id="products">
                <li class="active"><a href="#">CSS3 Animation</a></li>
                <li><a href="#">General</a></li>
                <li><a href="#">Buttons</a></li>
                <li><a href="#">Tabs & Accordions</a></li>
                <li><a href="#">Typography</a></li>
                <li><a href="#">FontAwesome</a></li>
                <li><a href="#">Slider</a></li>
                <li><a href="#">Panels</a></li>
                <li><a href="#">Widgets</a></li>
                <li><a href="#">Bootstrap Model</a></li>
            </ul>


            <li data-toggle="collapse" data-target="#service" class="collapsed">
                <a href="#"><i class="fa fa-globe fa-lg"></i> Services <span class="arrow"></span></a>
            </li>
            <ul class="sub-menu collapse" id="service">
                <li>New Service 1</li>
                <li>New Service 2</li>
                <li>New Service 3</li>
            </ul>


            <li data-toggle="collapse" data-target="#new" class="collapsed">
                <a href="#"><i class="fa fa-car fa-lg"></i> New <span class="arrow"></span></a>
            </li>
            <ul class="sub-menu collapse" id="new">
                <li>New New 1</li>
                <li>New New 2</li>
                <li>New New 3</li>
            </ul>


            <li>
                <a href="#">
                    <i class="fa fa-user fa-lg"></i> Profile
                </a>
            </li>

            <li>
                <a href="#">
                    <i class="fa fa-users fa-lg"></i> Users
                </a>
            </li>
        </ul>
    </div>
</div>
<div id="page-content-wrapper">
    @RenderBody()
    <hr />
</div>

@Renderbody() is like a php include, it gives a include from another file which in this case is the table that appears in the image.

(Table Code)

@{
  Layout = "~/Views/Shared/_Layout.cshtml";
}

<table style="width: 100%;" class="table table-striped table-bordered" cellpadding="0" cellspacing="0" width="100%" align="left">

    <thead>
        <tr role="row">
            <th aria-label="Tipo de Destino" style="width: 20%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="20%">Player ID</th>
            <th aria-label="Tipo de Destino" style="width: 20%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="20%">Name</th>
            <th aria-label="Tipo de Destino" style="width: 20%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="20%">Aliases</th>
            <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Arrested</th>
            <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Jail Time</th>
            <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Cop Level</th>
            <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Medic Level</th>            
        </tr>
    </thead>

    <tbody aria-relevant="all" aria-live="polite" role="alert">
            <tr class="odd">
                <td class=" ">76561198063412200</td>
                <td class=" ">Pioneer</td>
                <td class=" ">Pioneer</td>
                <td class=" ">No</td>
                <td class=" ">0</td>
                <td class=" ">Civil</td>
                <td class=" ">Civil</td>
            </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>

        <tr class="odd">
            <td class=" ">76561198063412200</td>
            <td class=" ">Pioneer</td>
            <td class=" ">Pioneer</td>
            <td class=" ">No</td>
            <td class=" ">0</td>
            <td class=" ">Civil</td>
            <td class=" ">Civil</td>
        </tr>


    </tbody>
</table>
  • NOTE: I am using bootstrap

  • 1

    I could post the layout code and explain better what that placement is?

  • Taking advantage, Welcome to [pt.so]. I realized that is starting now at Sopt. Read the guide [Ask] and do a [tour], to learn a little more about the operation of the site to increase your chances of getting a good answer.

  • The placement I speak of would be @Renderbody() inside _Layout.cshtml to fit according to the side menu (as shown in the image)

  • But your code is not like the image today? I still can’t understand what you want.

  • At a glance, the table is behind the side menu, I want the table to fit next to the side menu

  • Got it. Well, if you’re using bootstrap, try using the grids system you’re not using. Type: menu: <div class="col-md-2">menu aqui</menu> and table: <div class="col-md-2">RenderBody() Aquii</menu>. Anything in a minute I’ll give you an answer.

Show 2 more comments

1 answer

1


To my knowledge, to function, the <table> must be at least within a <div class="row"> and then inside a <div> configure the responsiveness. For example:

<div class="row">
    <div class="col-md-12">
        <table style="width: 100%;" class="table table-striped table-bordered" cellpadding="0" cellspacing="0" width="100%" align="left">

            <thead>
                <tr role="row">
                    <th aria-label="Tipo de Destino" style="width: 20%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="20%">Player ID</th>
                    <th aria-label="Tipo de Destino" style="width: 20%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="20%">Name</th>
                    <th aria-label="Tipo de Destino" style="width: 20%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="20%">Aliases</th>
                    <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Arrested</th>
                    <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Jail Time</th>
                    <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Cop Level</th>
                    <th aria-label="Tipo de Destino" style="width: 10%;" colspan="1" rowspan="1" aria-controls="DataTables_Table_0" tabindex="0" role="columnheader" class="sorting" width="10%">Medic Level</th>            
                </tr>
            </thead>

            <tbody aria-relevant="all" aria-live="polite" role="alert">
                    <tr class="odd">
                        <td class=" ">76561198063412200</td>
                        <td class=" ">Pioneer</td>
                        <td class=" ">Pioneer</td>
                        <td class=" ">No</td>
                        <td class=" ">0</td>
                        <td class=" ">Civil</td>
                        <td class=" ">Civil</td>
                    </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>

                <tr class="odd">
                    <td class=" ">76561198063412200</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">Pioneer</td>
                    <td class=" ">No</td>
                    <td class=" ">0</td>
                    <td class=" ">Civil</td>
                    <td class=" ">Civil</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
  • Thanks, I got it from what you and Randrade said, but I had to make some changes. <div class="Row" style="padding-left: 320px;"> <div class="col-Md-11"> @Renderbody() <hr /> </div> </div>

  • Possibly. Just do not recommend putting <div class="row"> before @RenderBody that doesn’t look good.

  • <div class="col-Md-11" style="padding-left: 340px;"> @Renderbody() <hr /> </div> E put the div class "Row" inside the . cshtml where only Table is located

  • Follow print, http://puu.sh/moizr/3fdb26a09a.png

  • Now we do. We can use col-md-12 instead of col-md-11 to fill the entire screen space.

  • You did well with col-Md-12, thank you very much!

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.