页面打印后,字段周围的边框不可见

时间:2017-03-08 17:11:30

标签: html css

我有简单的表单,几个字段,用户插入值后可以单击按钮打印并打印页面。

除非实际打印执行输入字段时缺少边框,否则一切正常。

这是表格

    <form name="hongkiat" id="hongkiat-form" method="post" action="#">

    <div id="wrapping" class="clearfix">

        <section id="aligned">

            <div class="block">
                <label for="name">Full Name</label>
                <input type="text" name="name" id="name" placeholder="" autocomplete="off" tabindex="1" class="txtinput">
            </div>
            <div class="block">
                <label for="name">Email Address</label>
                <input type="email" name="email" id="email" placeholder="" autocomplete="off" tabindex="2" class="txtinput">
            </div>
            <div class="block">
                <label for="name">Statement</label>
                <textarea name="message" id="message" placeholder="" tabindex="5" class="txtblock"></textarea>
            </div>
        </section>

    </div>
    <section id="buttons">
        <input type="button" value="Print This Page" class="resetbtn" id="resetbtn" onClick="window.print()">
        <br style="clear:both;">
    </section>
    </form>

这就是css

#hongkiat-form { box-sizing: border-box; }

#hongkiat-form .txtinput { 
    display: block;
    font-family: "Helvetica Neue", Arial, sans-serif;
    border-style: solid;
    border-width: 2px;
    border-color: #dedede;
    margin-bottom: 30px;
    font-size: 1.55em;
    padding: 11px 20px;
    width: 65%;
    color: #777;
        float: right;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset;
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset;
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset; 
    transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
    -webkit-transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
    -moz-transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
    -o-transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
}

#hongkiat-form .txtinput:focus { 
    color: #333;
    border-color: rgba(41, 92, 161, 0.4);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6);
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6);
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(41, 92, 161, 0.6);
    outline: 0 none; 
}


#hongkiat-form textarea {
    display: block;
    font-family: "Helvetica Neue", Arial, sans-serif;
    border-style: solid;
    border-width: 1px;
    border-color: #dedede;
    margin-bottom: 25px;
    font-size: 1.5em;
    padding: 11px 20px;
    width: 65%;
    height: 180px;
    color: #777;
        float: right;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset;
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset;
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset; 
    transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
    -webkit-transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
    -moz-transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
    -o-transition: border 0.15s linear 0s, box-shadow 0.15s linear 0s, color 0.15s linear 0s;
}
#hongkiat-form textarea:focus {
    color: #333;
    border-color: rgba(41, 92, 161, 0.4);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(40, 90, 160, 0.6);
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(40, 90, 160, 0.6);
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(40, 90, 160, 0.6);
    outline: 0 none; 
}

#hongkiat-form #aligned { 
    box-sizing: border-box; 
    float: left; 
    width: 910px; 
    margin-right: 50px; 
}

#wrapping { width: 100%; box-sizing: border-box; }
.block label {
    display: inline-block;
    width:150px; 
    float:left;
    font-family: "Droid Serif", Georgia, serif;
    font-size: 2em;
    line-height: 1.5em;
    font-weight: 900;  
    margin: 5px;
}
label { clear: both; }

我在打印文档上看到并以pdf格式扫描的内容如下: enter image description here

这是表格看起来很好的演示..:https://jsfiddle.net/aooL87wy/1/

1 个答案:

答案 0 :(得分:0)

你真的需要打印的盒子阴影效果吗?

这里有一个简单的边境财产:

border: 2px solid #dedede;

Here a fiddle