整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          在網頁設計過程中正確理解css圓角邊框及背景圖

          建企業網站時使用CSS邊框圓角是很容易的事,但要設置邊框圓角的漸變效果就需要費些功夫了,需要正確理解幾個CSS屬性的含義,background-origin,background-clip,background-size這幾個是必須用到的,調整好性能的數值就可以靈活運用了。

          想要實現CSS圓角漸變并匹配內容背景圖可以參考以下代碼:

          <style>
          div {
           width: 500px;
           height: 300px;
           margin: 10px;
           padding: 30px;
           border-radius: 50px; /*設置圓角*/
           border:50px solid transparent; /*設置邊框顏色透明,確保背景漸變色顯示*/
           background-origin:border-box; /*從邊框開始背景圖*/
           background-clip:padding-box,border-box; /*設置第一個背景和第二個背景的范圍*/
           background-size:cover;
           /*由于背景圖像不能設置純色,所以可以使用下面的方式設置純色*/
           background-image:linear-gradient(#fff, #fff),linear-gradient(#FC0, #F30); 
          }
          .a1{display:block;height:280px;background-image:url(/images/school.jpg);
          background-repeat:no-repeat;background-size:contain;}
          </style>
          
          <div>
          <span class="a1">邊框漸變色從內邊框到邊框,背景圖像單獨設置不重復。</span>
          </div>

          background-origin表示的是背景起始位置,其三個值如下,依次是

          border-box 從邊框開始;
          padding-box(默認) 從內邊距開始;
          content-box 從內容開始。

          background-origin: border-box | padding-box(默認) | content-box

          background-clip表示的是背景填充位置,其四個值如下,依次是

          border-box(默認) 填充至邊框;
          padding-box 填充至內邊距;
          content-box 填充之內容;
          text 作為字體前景色。

          background-clip: border-box(默認) | padding-box | content-box | text

          background-size表示的是背景尺寸,其五個值如下,依次是

          contain 將圖像擴大至適應最短的邊,剩余部分默認重復圖像
          cover 將圖像擴大至適應最長的邊,圖像可能顯示不完整
          length 兩個值依次設置圖像寬和高,未設置則為auto
          percentage 兩個百分比依次設置圖像寬和高,未設置則為auto
          auto 默認設置

          載地址在github,文末有使用方法

          github地址:https://github.com/crabbly/Print.js/

          官網:https://printjs.crabbly.com/(可能被墻)

          無法訪問可以加企鵝群看離線版:1006429377

          或者訪問:https://www.yuque.com/caiyongjie/snknlo/ga5ef9

          官網截圖

          簡介

          • 原文:

          Print.js was primarily written to help us print PDF files directly within our apps, without leaving the interface, and no use of embeds. For unique situations where there is no need for users to open or download the PDF files, and instead, they just need to print them.

          One scenario where this is useful, for example, is when users request to print reports that are generated on the server side. These reports are sent back as PDF files. There is no need to open these files before printing them. Print.js offers a quick way to print these files within our apps.

          • 谷歌翻譯:

          Print.js主要是為了幫助我們直接在我們的應用程序中打印PDF文件,而無需離開界面,也不使用嵌入。 對于不需要用戶打開或下載PDF文件的獨特情況,相反,他們只需要打印它們。

          例如,當用戶請求打印在服務器端生成的報告時,這種情況很有用。 這些報告以PDF文件形式發回。 打印前無需打開這些文件。 Print.js提供了一種在我們的應用程序中打印這些文件的快捷方式。

          • 注意的地方:

          PDF files must be served from the same domain as your app is hosted under. Print.js uses iframe to load files before printing them, therefore, it is limited by the Same Origin Policy. This helps preventing Cross-site scripting (XSS) attacks.

          必須在托管應用程序的同一域中提供PDF文件。 Print.js在打印文件之前使用iframe加載文件,因此它受同源策略的限制。 這有助于防止跨站點腳本(XSS)攻擊。

          初體驗

          首先在頁面上添加一個按鈕

          • 打印PDF(注意:火狐不支持iframes,可以使用新標簽頁)
          <button type="button" onclick="printJS('docs/printjs.pdf')">
           Print PDF
           </button>
          
          • 打印大文件(可以彈出提示消息)
          <button type="button" onclick="printJS({printable:'docs/xx_large_printjs.pdf', type:'pdf', showModal:true})">
           Print PDF with Message
           </button>
          
          • html打印
           <form method="post" action="#" id="printJS-form">
           ...
           </form>
           <button type="button" onclick="printJS('printJS-form', 'html')">
           Print Form
           </button>
          
          • 打印帶頭部
           <button type="button" onclick="printJS({ printable: 'printJS-form', type: 'html', header: 'PrintJS - Form Element Selection' })">
           Print Form with Header
           </button>
          
          • 打印圖片
          <img src="images/print-01.jpg" />
           printJS('images/print-01-highres.jpg', 'image')
           printJS({printable: 'images/print-01-highres.jpg', type: 'image', header: 'My cool image header'})
          
          • 帶頭
           printJS({
           printable: ['images/print-01-highres.jpg', 'images/print-02-highres.jpg', 'images/print-03-highres.jpg'],
           type: 'image',
           header: 'Multiple Images',
           imageStyle: 'width:50%;margin-bottom:20px;'
           })
          
          • 從JSON數據
           someJSONdata = [
           {
           name: 'John Doe',
           email: 'john@doe.com',
           phone: '111-111-1111'
           },
           {
           name: 'Barry Allen',
           email: 'barry@flash.com',
           phone: '222-222-2222'
           },
           {
           name: 'Cool Dude',
           email: 'cool@dude.com',
           phone: '333-333-3333'
           }
           ]
           <button type="button" onclick="printJS({printable: someJSONdata, properties: ['name', 'email', 'phone'], type: 'json'})">
           Print JSON Data
           </button>
          
          • 自定義CSS
           <button type="button" onclick="printJS({
          	 printable: someJSONdata,
          	 properties: ['name', 'email', 'phone'],
          	 type: 'json',
          	 gridHeaderStyle: 'color: red; border: 2px solid #3971A5;',
          	 gridStyle: 'border: 2px solid #3971A5;'
          	})">
           Print JSON Data
           </button>
          
          • 自定義頭
           <button type="button" onclick="printJS({
          	 printable: someJSONdata,
          	 properties: [
          		{ field: 'name', displayName: 'Full Name'},
          		{ field: 'email', displayName: 'E-mail'},
          		{ field: 'phone', displayName: 'Phone'}
          	 ],
          	 type: 'json'
           })">
           Print with custom table header text
           </button>
          <button type="button" onclick="printJS({
          		printable: someJSONdata,
          		type: 'json',
          		properties: ['name', 'email', 'phone'],
          		header: '<h3 class="custom-h3">My custom header</h3>',
          		style: '.custom-h3 { color: red; }'
          	 })">
          	Print header raw html
          </button>
          

          安裝使用

           npm install print-js --save
          //或
           yarn add print-js
          


          import print from 'print-js'
          


           //cdn,不知道能不能訪問,我這可以訪問
           https://printjs-4de6.kxcdn.com/print.min.js
           https://printjs-4de6.kxcdn.com/print.min.cssye
           <script src="print.js"></script>
          
          • 如果您將使用模態功能,還包括頁面上的Print.css。
           <link rel="stylesheet" type="text/css" href="print.css">
          



          詳細配置:

          兼容性

          ostbirdAlertBox.js

          下載地址:

          https://github.com/postbird/PostbirdAlertBox.js

          Alert

          PostbirdAlertBox.alert({
              'title': '提示標題',
              'content': '提示內容主體',
              'okBtn': '好的',
              'contentColor': 'red',
              'onConfirm': function () {
              console.log("回調觸發后隱藏提示框");
              alert("回調觸發后隱藏提示框");
          }

          });

          Confirm

          PostbirdAlertBox.confirm({
              'title': '提示標題',
              'content': '離開本頁面進行跳轉',
              'okBtn': '好的',
              'contentColor': 'red',
              'onConfirm': function () {
              console.log("OK - 回調觸發后隱藏提示框");
              alert("OK - 回調觸發后隱藏提示框");
              },
              'onCancel': function () {
              console.log("Cancel-回調觸發后隱藏提示框");
              alert("Cancel-回調觸發后隱藏提示框");
              }
          });

          Prompt

          PostbirdAlertBox.prompt({
          'title': '請輸入姓名',
          'okBtn': '提交',
          onConfirm: function (data) {
          console.log("輸入框內容是:" + data);
          alert("輸入框內容是:" + data);
          },
          onCancel: function (data) {
          console.log("輸入框內容是:" + data);
          alert("輸入框內容是:" + data);
          },
          });

          使用說明

          1. 引入js 和 css 文件

          2. 通過全局對象 PostbirdAlertBox 調用相關方法,三個方法為: PostbirdAlertBox.alert({}); PostbirdAlertBox.confirm({}); PostbirdAlertBox.prompt({});

          配置參數

          參數屬性 意義 適用方法 是否必須

          title 彈框標題 alert、confirm(不適用于prompt) 否, 默認 : 提示信息

          promptTitle prompt標題 prompt 否, 默認 :請輸入內容

          content 提示內容主體 alert、confirm(不適用于prompt) 否, 默認 : 提示內容

          contentColor 提示內容顏色 alert、confirm 否,默認 : #000000

          okBtn 確認按鈕文字 alert、confirm(不適用于prompt) 否, 默認 : 好的

          promptOkBtn prompt確認按鈕文字 prompt 否, 默認 : 確認

          okBtnColor 確認按鈕顏色 alert、confirm、prompt 否, 默認 : #0e90d2

          cancelBtn 取消按鈕文字 alert、confirm、prompt 否, 默認 : 取消

          onConfirm 確認按鈕事件 alert、confirm、prompt(存在參數data) 否, 默認 : 不觸發事件

          onCancel 取消按鈕事件 alert、confirm、prompt(存在參數data) 否, 默認 : 不觸發事件

          參數說明

          1. title 和 promptTitle 分開主要是為了方便不傳遞title的情況,prompt和alert、confirm的顯示文字不同

          2. okBtn 和 promptOkBtn 分開同樣是為了默認情況下,prompt和alert、confirm的顯示文字不同

          3. 正如前面的示例代碼中,prompt的回調函數,會給予一個data參數,用來獲取用戶輸入的內容


          主站蜘蛛池模板: 国产日韩精品一区二区三区在线| 亚洲国产福利精品一区二区| 伊人色综合视频一区二区三区| 亚洲色精品aⅴ一区区三区| 武侠古典一区二区三区中文| 亚洲国产成人一区二区三区| 精品国产一区二区三区免费看| 亚洲午夜福利AV一区二区无码 | 日韩人妻无码一区二区三区 | 国产成人无码一区二区在线播放| 精品亚洲AV无码一区二区三区| 相泽亚洲一区中文字幕| 国产未成女一区二区三区| 少妇激情AV一区二区三区| 亚洲人成人一区二区三区| 日本韩国一区二区三区| 在线一区二区三区| 香蕉久久ac一区二区三区| 欧美日本精品一区二区三区| 亚洲香蕉久久一区二区三区四区| 69福利视频一区二区| 国产精品综合一区二区三区| 国产精品区一区二区三在线播放| 亚洲一区无码中文字幕乱码| 日韩一区二区免费视频| 一区二区三区免费看| 鲁丝片一区二区三区免费| 欧美日韩一区二区成人午夜电影| 变态调教一区二区三区| 精品视频一区二区三区| 亚洲日本一区二区一本一道 | 日韩精品无码一区二区中文字幕| 久久精品无码一区二区WWW| 日本精品一区二区三区视频| 日本亚洲国产一区二区三区| 精品国产日韩一区三区| 精品国产免费一区二区三区香蕉| 精品无码人妻一区二区三区不卡 | 精品国产一区二区麻豆| 无码一区二区三区在线 | 国产无人区一区二区三区|