検索ボックスの背景色を変更したいです。
実現したいこととしましては、以下の画像のように検索ボックスの背景画像の色を変更したいです。
以下は自分で作成したコードとなります。
html
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="utf-8"> 5 <link rel="stylesheet" href="normalize.css"> 6 <link rel="stylesheet" href="github.css" /> 7</head> 8<body> 9 <header> 10 <div class="header_menu header_flex"> 11 <div> 12 <a href="#"> 13 <svg class="githubIcon" viewBox="0 0 16 16" version="1.1" height="32" width="32" role="img"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg> 14 </a> 15 </div> 16 <div class="search_box_wrap"> 17 <label> 18 <form action="#" method="get"> 19 <input id="search_box"name="serch" placeholder="Serch or jump to..." type="txt" /> 20 </form> 21 <img class="search_img"alt="search_key_slash"src="img/search-shortcut-hint.svg"> 22 </label> 23 </div> 24 <ul class="header_link header_flex flex_items_center text_bold"> 25 <li><a href="#">Pull request</a></i> 26 <li><a href="#">Issues</a></li> 27 <li><a href="#">Marketplace</a></li> 28 <li><a href="#">Explore</a></li> 29 </ul> 30 31 <div class="nav_list"> 32 <ul class="user_nav"> 33 34 <li><a href="#"><svg class="header_nav_bell" viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M13.99 11.991v1H0v-1l.73-.58c.769-.769.809-2.547 1.189-4.416.77-3.767 4.077-4.996 4.077-4.996 0-.55.45-1 .999-1 .55 0 1 .45 1 1 0 0 3.387 1.229 4.156 4.996.38 1.879.42 3.657 1.19 4.417l.659.58h-.01zM6.995 15.99c1.11 0 1.999-.89 1.999-1.999H4.996c0 1.11.89 1.999 1.999 1.999z"></path></svg></a></li> 35 <li> 36 <details> 37 <summary> 38 <svg class="header_nav_plus float_left" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5v2z"></path></svg> 39 <span class="dropdown_caret"></span> 40 </summary> 41 <a role="menuitem" href="#">New repository</a> 42 <a role="menuitem" href="#">Import repository</a> 43 <a role="menuitem" href="#">New gist</a> 44 <a role="menuitem" href="#">New organization</a> 45 </details> 46 </li> 47 <li> 48 <details> 49 <summary class="avator"> 50 <img class="float_left" src="img/avatar.png" width=20 height=20 /> 51 <span class="dropdown_caret"></span> 52 </summary> 53 <ul> 54 <li> 55 <a href="#">Signed in as<strong>USER NAME</strong>></a> 56 </li> 57 <li> 58 <a role="menuitem" href="#">Your profile</a> 59 </li> 60 <li> 61 <a role="menuitem" href="#">Your repositories</a> 62 </li> 63 <li> 64 <a role="menuitem" href="#">Your stars</a> 65 </li> 66 <li> 67 <a role="Your gist" href="#">Your gist</a> 68 </li> 69 <li> 70 <a role="menuitem" href="#">Help</a> 71 </li> 72 <li> 73 <a role="menuitem" href="#">Setting</a> 74 </li> 75 <li> 76 <a role="menuitem" href="#">Sign out</a> 77 </li> 78 </ul> 79 </details> 80 </li> 81 </ul> 82 </div> 83 </div> 84 85 </header> 86 87 88 89</body> 90 91</html> 92
css
1*{ 2 box-sizing:border-box; 3} 4.body{ 5 font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; 6 line-height:1.5; 7} 8.text_bold{ 9 font-weight:600; 10} 11.header{ 12 padding 13} 14svg { 15 fill: currentColor; 16 } 17 18 19.githubIcon{ 20 color:white; 21 margin-left:16px; 22 margin-right:13px; 23} 24.search_img{ 25 position: absolute; 26 top: 0; 27 right: 0; 28 margin:2px 2px; 29 30} 31#search_box{ 32 background-color:hsla(0,0,100%,0.125); 33} 34.search_box_wrap { 35 36 position: relative; 37} 38.avator{ 39 margin-right:16px; 40} 41 42 43header{ 44 background-color:#000; 45} 46.header_link{ 47 font-size:14px; 48} 49.header_flex{ 50 display:flex; 51 align-items: center; 52} 53 54 55.flex_items_center{ 56 display:flex; 57 justify-content: space-between; 58} 59.flex_items_center a{ 60 text-decoration:none; 61 color:#fff; 62} 63.header_link{ 64 list-style:none; 65 padding-left:8px; 66} 67.header_link li { 68 padding: 0 8px; 69} 70 71 72.user_nav{ 73 display:flex; 74 list-style:none; 75 76} 77.nav_list{ 78 display:flex; 79 margin-left:auto; 80} 81.header_nav_bell{ 82 color:gray; 83} 84.dropdown_caret{ 85 width: 0; 86 height: 0; 87 border-left: 5px solid transparent; 88 border-right: 5px solid transparent; 89 border-top: 5px solid #fff; 90 /*ブロック要素になっている為、inline-blockで横並びにする*/ 91 display: inline-block; 92 margin-bottom:1.5px; 93} 94.header_nav_plus{ 95 color:#fff; 96} 97.user_nav svg, 98.user_nav img { 99 vertical-align: middle; 100}

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/12 11:09
2018/10/12 11:11
2018/10/12 11:17
2018/10/12 11:21
2018/10/12 11:33
2018/10/12 11:36
2018/10/12 11:47
2018/10/12 11:49