绝对在打印页面中不起作用

时间:2017-01-07 09:25:34

标签: html css printing

我有一个laravel项目,我把表id作为print

<div class="panel panel-primary">
<div class="panel-heading">
    <h3 class="panel-title">المستخدمين</h3>
    <span class="pull-left clickable"><i class="glyphicon glyphicon-chevron-up"></i></span>
</div>
<div class="panel-body" id='print''>
    <h3>مجموع المستخدمين <kbd>{{$users_total}}</kbd></h3>
    {{$users->links()}}
    <table class='table table-responsive table-hover table-responsive sortable draggable'  border='5'>
        <thead>
            <tr class='warning'>
                <td>اسم المستخدم <a class='delete'>delete</a></td>
                <td>الصورة <a class='delete'>delete</a></td>
                <td>الايميل <a class='delete'>delete</a></td>
                <td>التصريح <a class='delete'>delete</a></td>
                <td>رقم الهاتف <a class='delete'>delete</a></td>
                <td>الفرع <a class='delete'>delete</a></td>
                <td>الاعدادات <a class='delete'>delete</a></td>
            </tr>
        </thead>
        <tbody>
            @foreach($users as $user)
                @if($user->trashed())
                <tr class='bg-danger'>
                    <td>
                    <input type='hidden' value='{{$user->id}}' />
                        <div contenteditable="true" class='contenteditable' id='username'>{{$user->username}}</div>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        @if(!file_exists( base_path()."/storage/app/users/$user->id"))
                            asdf
                        @else
                            sadfsd
                        @endif
                    </td>
                    <td>
                        <div contenteditable="true" class='contenteditable' id='email'>{{$user->email}}</div>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <select class='form-control selecting' id='permission' >
                        @foreach($permissions as $permission)
                            @if($permission->id == $user->permission)
                                <option value='{{$permission->id}}' style='color:red' selected='true'>{{$permission->permission_name}}</option>
                            @else
                                <option value='{{$permission->id}}'>{{$permission->permission_name}}</option>
                            @endif
                        @endforeach
                        </select>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <div contenteditable="true" class='contenteditable' id='phone'>{{$user->phone}}</div>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <select class='form-control selecting' id='division'>
                        @foreach($divisions as $division)
                            @if($division->id == $user->division)
                                <option value='{{$division->id}}' style='color:red' selected='true'>{{$division->division_name}}</option>
                            @else
                                <option value='{{$division->id}}'>{{$division->division_name}}</option>
                            @endif
                        @endforeach
                        </select>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <a target='_blank' href='/users/{{$user->id}}'><button class='btn btn-success'>عرض</button></a>
                        <a target='_blank' href='/users/{{$user->id}}/edit'><button class='btn btn-info'>تعديل</button></a>
                        <button class='btn btn-warning restoreData' value='{{$user->id}}'>استعادة</button>
                        <button class='btn btn-danger deleteDataForever' value='{{$user->id}}'>حذف للأبد</button>
                        <div class='ajaxResult'></div>
                    </td>
                </tr>                       
                @else
                <tr>
                    <td>
                        <input type='hidden' value='{{$user->id}}' />
                        <div contenteditable="true" class='contenteditable' id='username'>{{$user->username}}</div>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        @if(!file_exists( base_path()."/public/upload/users/$user->id/$user->username.jpg"))
                            <img class='thumb img img-responsive' src='{{ asset("/upload/no.jpg")}}'/>
                        @else
                            <a data-title='{{$user->username}}'  data-lightbox="image-1" target='_blank' href='{{ asset("/upload/users/$user->id/$user->username.jpg")}}'>
                                <img title='{{$user->username}}'class='thumb img img-responsive' src='{{ asset("/upload/users/$user->id/$user->username.jpg")}}'/>
                                <a href='/users/{{$user->id}}'>{{$user->username}}</a>
                            </a>                            
                        @endif                          
                    </td>                       
                    <td>
                        <div contenteditable="true" class='contenteditable' id='email'>{{$user->email}}</div>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <select class='form-control selecting' id='permission'>
                        @foreach($permissions as $permission)
                            @if($permission->id == $user->permission)
                                <option value='{{$permission->id}}' style='color:red' selected='true'>{{$permission->permission_name}}</option>
                            @else
                                <option value='{{$permission->id}}'>{{$permission->permission_name}}</option>
                            @endif
                        @endforeach
                        </select>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <div contenteditable="true" class='contenteditable' id='phone'>{{$user->phone}}</div>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <select class='form-control selecting' id='division'>
                        @foreach($divisions as $division)
                            @if($division->id == $user->division)
                                <option value='{{$division->id}}' style='color:red' selected='true'>{{$division->division_name}}</option>
                            @else
                                <option value='{{$division->id}}'>{{$division->division_name}}</option>
                            @endif
                        @endforeach
                        </select>
                        <div class='ajaxResult'></div>
                    </td>
                    <td>
                        <a target='_blank' href='/users/{{$user->id}}'><button class='btn btn-success'>عرض</button></a>
                        <a target='_blank' href='/users/{{$user->id}}/edit'><button class='btn btn-info'>تعديل</button></a>
                        <button class='btn btn-danger deleteData'>حذف</button>
                        <div class='ajaxResult'></div>
                    </td>
                </tr>
                @endif
            @endforeach
        </tbody>
    </table>
    <h3>مجموع المستخدمين <kbd>{{$users_total}}</kbd></h3>
    {{$users->links()}}
</div>

现在,当我想要打印页面时,我做了这个css

@media print 
{
body * 
{
    visibility: hidden;
}
#print, #print * 
{
    visibility: visible;
}
#print 
{
    position: absolute;
    left: 0;
    top: 0;
}
}

但在#print中,该位置现在作为绝对位置或从左侧和上方起作用。

从150px开始,总有一些保证金。

我试图让保证金从顶部开始作为保证金最高限额:1500px它也不起作用

谢谢

0 个答案:

没有答案