{"id":1285,"date":"2017-03-20T18:15:34","date_gmt":"2017-03-20T12:45:34","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=1285"},"modified":"2018-11-01T12:06:42","modified_gmt":"2018-11-01T06:36:42","slug":"remove-border-outline-around-textinput-boxes","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/remove-border-outline-around-textinput-boxes\/","title":{"rendered":"How to remove border (outline) around text\/input boxes"},"content":{"rendered":"<h2 id=\"problem\"><span style=\"color: #000080;\"><strong><label class=\"label label-Warning\">PROBLEM:<\/label><\/strong><\/span><\/h2>\n<p>How to <span style=\"color: #000000;\"><strong>remove the orange or blue border<\/strong><\/span> (outline) around text\/input boxes? It only happens on Chrome to show that the input box is active.<\/p>\n<p>Here&#8217;s the input <a href=\"https:\/\/www.wikitechy.com\/css\/\" target=\"_blank\" rel=\"noopener\">CSS<\/a> :<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">input {<br\/>\t\t\t    background-color: transparent;<br\/>\t\t\t    border: 0px solid;<br\/>\t\t\t    height: 20px;<br\/>\t\t\t    width: 160px;<br\/> \t\t\t   color: #CCC;<br\/>\t\t\t}<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<h2 id=\"solution-1\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 1:<\/label><\/span><\/h2>\n<p>This border is used to show that the element is focused (i.e. you can type in the input or press the button with Enter). You can remove it, though:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">textarea:focus, input:focus{<br\/>\t\t \t   outline: none;<br\/>\t\t\t}<\/code><\/pre> <\/div>\n<p>You may want to add some other way for users to know what element has <a href=\"https:\/\/www.wikitechy.com\/tutorials\/javascript\/how-to-detect-pressing-enter-or-keyboard-using-jquery\" target=\"_blank\" rel=\"noopener\">keyboard<\/a> focus though for usability.<\/p>\n<p><a href=\"https:\/\/www.wikitechy.com\/technology\/enable-reader-mode-chrome-android\/\" target=\"_blank\" rel=\"noopener\">Chrome<\/a> will also apply highlighting to other elements such as DIV&#8217;s used as modals. To <span style=\"color: #000000;\"><strong>prevent the highlight<\/strong><\/span> on those and all other elements as well, you can do:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">*:focus {<br\/>    \t\t\toutline: none;<br\/>\t\t\t}<\/code><\/pre> <\/div>\n<h2 id=\"solution-2\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 2:<\/label><\/span><\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">input:focus {<br\/>outline:none;<br\/>}<\/code><\/pre> <\/div>\n<h2 id=\"solution-3\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 3:<\/label><\/span><\/h2>\n<p>This will do.<span style=\"color: #000000;\"><strong> Orange outline<\/strong><\/span> won&#8217;t show up anymore.<\/p>\n<p>Here is the solution :<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">.form-control:focus {<br\/>  border-color: inherit;<br\/>  -webkit-box-shadow: none;<br\/>  box-shadow: none;<br\/>}<\/code><\/pre> <\/div>\n<h2 id=\"solution-4\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 4:<\/label><\/span><\/h2>\n<p>Use the following syntax to <span style=\"color: #000000;\"><strong>remove the border of text box<\/strong><\/span> and remove the highlighted border of browser style.<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">input {<br\/>    background-color:transparent;<br\/>    border: 0px solid;<br\/>    height:30px;<br\/>    width:260px;<br\/>}<br\/>input:focus {<br\/>    outline:none;<br\/>}<\/code><\/pre> <\/div>\n<h2 id=\"solution-5\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 5:<\/label><\/span><\/h2>\n<p>Try this code :<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">&lt;input style=&quot;border:none&quot; &gt;<\/code><\/pre> <\/div>\n<h2 id=\"solution-6\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 6:<\/label><\/span><\/h2>\n<p>This remove orange frame in <a href=\"https:\/\/www.wikitechy.com\/technology\/27-handy-chrome-os-commands-run-crosh\/\" target=\"_blank\" rel=\"noopener\">chrome<\/a> from all and any element no matter what and where is it<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">*:focus {<br\/>\t\t\t\t    outline: none;<br\/>\t\t\t\t}<\/code><\/pre> <\/div>\n<p style=\"top: 106px;\">[ad type=&#8221;banner&#8221;]\n<h2 id=\"solution-7\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 7:<\/label><\/span><\/h2>\n<p>Common for all tags:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">*:focus {<br\/>    outline: none;<br\/>\t\t}<\/code><\/pre> <\/div>\n<p>Specific to some tag, ex: input tag<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">input:focus {<br\/>\t\t   outline:none;<br\/>\t\t}<\/code><\/pre> <\/div>\n<h2 id=\"solution-8\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 8:<\/label><\/span><\/h2>\n<p>When an input element set to focus in Web Kit <a href=\"https:\/\/www.wikitechy.com\/technology\/10-best-web-browsers-linux\/\" target=\"_blank\" rel=\"noopener\">browsers<\/a> like Safari and Chrome, the browser will put a blurry blue\/yellow border around it.<\/p>\n<p>This could be confusing and could make your design look different. To disable this we can use the following code.<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">\/* remove border around all input elements *\/<br\/>input:focus {<br\/>    outline: none;}<br\/>\/* remove border around all textarea elements *\/<br\/>textarea:focus {<br\/>    outline: none;}<br\/>\/* remove border around all select elements *\/<br\/>select:focus {<br\/>    outline: none;}<br\/>\/* remove border around all input,textarea and select elements *\/<br\/>input:focus, textarea:focus, select:focus {<br\/>    outline: none;}<br\/>\/* remove border around all elements *\/<br\/>:focus {<br\/>    outline: none;}<\/code><\/pre> <\/div>\n<h2 id=\"solution-9\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 9:<\/label><\/span><\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">*:focus {<br\/>\t\t    outline: 0;<br\/>\t\t}<\/code><\/pre> <\/div>\n<p><span style=\"color: #000000;\"><strong>Note:<\/strong> <\/span>On focus Use outline:0 in spite of outline:none. It&#8217;s valid and better practice.<\/p>\n<h2 id=\"solution-10\"><span style=\"color: #ff0000;\"><label class=\"label label-info\">SOLUTION 10:<\/label><\/span><\/h2>\n<p>you can also use:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">Css Code<\/span> <\/div> <pre class=\"language-css code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-css code-embed-code\">input:focus{<br\/>\t\t   border: transparent;<br\/>\t\t}<\/code><\/pre> <\/div>\n<p style=\"top: 106px;\">[ad type=&#8221;banner&#8221;]\n","protected":false},"excerpt":{"rendered":"<p>PROBLEM: How to remove the orange or blue border (outline) around text\/input boxes? It only happens on Chrome to show that the input box is active. Here&#8217;s the input CSS : [ad type=&#8221;banner&#8221;] SOLUTION 1: This border is used to show that the element is focused (i.e. you can type in the input or press [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,24],"tags":[2486,2483,2484,2498,2494,2490,2489,2487,2496,2499,2488,2493,2492,2485,2491,2497,2495],"class_list":["post-1285","post","type-post","status-publish","format-standard","hentry","category-css","category-html","tag-css-how-to-remove-borders-around-textbox-when-adding-background","tag-css-how-to-remove-the-border-highlight-on-an-input-text-element","tag-css-remove-borders-around-html-input","tag-css-input-focus-border-color","tag-css-input-outline","tag-css-outline-color-property","tag-glowing-blue-input-highlights","tag-html-remove-the-border-when-focusing-on-an-input-box","tag-input-focus-css-glow","tag-remove-blue-border-on-click","tag-remove-border-from-field","tag-remove-border-from-input-type-text","tag-remove-focus-outline-css","tag-remove-input-box-border-using-css","tag-remove-shadowsborders-from-input-box","tag-remove-textbox-border-css","tag-textbox-without-border-in-html"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/1285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=1285"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/1285\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=1285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=1285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}