整合營銷服務商

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

          免費咨詢熱線:

          在網頁設計過程中正確理解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參數,用來獲取用戶輸入的內容


          主站蜘蛛池模板: 日本一道高清一区二区三区| 国产精品日本一区二区不卡视频| 国产欧美一区二区精品仙草咪| 91精品国产一区二区三区左线 | 无码日韩AV一区二区三区| 男人的天堂亚洲一区二区三区| 无码人妻AV免费一区二区三区| 国产成人一区在线不卡| 无码AV动漫精品一区二区免费| 国内精品视频一区二区三区| 日韩精品一区二区三区老鸭窝 | 国产精品区AV一区二区| 亚洲福利视频一区二区| 国产人妖视频一区在线观看| 日韩在线一区视频| 国精产品999一区二区三区有限| 亚洲一区在线观看视频| 精品一区二区三区波多野结衣| 国产美女精品一区二区三区| 精品一区二区三区四区| 麻豆一区二区在我观看| 日本激情一区二区三区| 一本大道在线无码一区| 无码人妻久久一区二区三区蜜桃 | 国产Av一区二区精品久久| 高清一区二区在线观看| 中文字幕乱码一区二区免费| 亚洲AV无码一区东京热久久| 亚洲福利视频一区二区三区| 日本高清一区二区三区| 久久精品国产一区二区三区不卡| 亚洲乱码国产一区三区| 日韩一区二区三区射精| 久久精品国产亚洲一区二区| 国产精品高清视亚洲一区二区| 四虎一区二区成人免费影院网址 | 国产精品视频一区二区三区四| 中文字幕av人妻少妇一区二区| 久久国产高清一区二区三区| 伊人色综合网一区二区三区 | 亚洲av片一区二区三区|