LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Wednesday, December 13, 2017

placeholderの色を変更する


placeholderの文字色を変更したくて調べた時に書いたコードです




    ::-webkit-input-placeholder {
      color: pink;
    }


<style></style>内に上記の設定を書くと指定した色に変更できるようです(Chrome)


HTML Serviceで実際に試してみた例が以下のコードです



コード.gs
function doGet(){
 return HtmlService.createHtmlOutputFromFile('index'); 
}
意訳
この処理は以下を実行する
指定したHTMLファイルを表示する




index.html
<!DOCTYPE html>
<html>
<head>
  <style>
    ::-webkit-input-placeholder {
      color: pink;
    }
  </style>
</head>
<body>
  <input type="text" placeholder="テキスト入力">
</body>
</html>
意訳
HTMLの宣言
ここからhtml
ここからhead
ここからstyle
placeholderの
文字色をpinkにする

ここまでstyle
ここまでhead
ここまでbosy
テキストボックスを配置する
ここまでbody
ここまでhtml


関連記事

HTMLServiceで試す手順
Google Apps ScriptのWebアプリ雛形

Latest post

Extracting data from Google Sheets with regular expressions

Introduction Regular expressions are a powerful tool that can be used to extract data from text.  In Google Sheets, regular expressions ca...