{"id":2649,"date":"2020-03-13T21:04:57","date_gmt":"2020-03-13T20:04:57","guid":{"rendered":"https:\/\/da-software.de\/?p=2649"},"modified":"2020-03-13T21:04:57","modified_gmt":"2020-03-13T20:04:57","slug":"adjust-form-fields-border-or-frame-with-css","status":"publish","type":"post","link":"https:\/\/da-software.net\/en\/2020\/03\/adjust-form-fields-border-or-frame-with-css\/","title":{"rendered":"Adjust form fields border or frame with CSS"},"content":{"rendered":"<p>For HTML or web forms, different HTML form fields are used by default, such as <em><strong>input<\/strong><\/em>, <em><strong>textareas<\/strong><\/em>. These are displayed by the different browsers by default with a small frame, unless you have included a <a title=\"Selection of 10 CSS libraries\" href=\"https:\/\/geekflare.com\/best-css-frameworks\/\" target=\"_blank\" rel=\"noopener noreferrer\">CSS library<\/a> which already adopts these formatting.<\/p>\n<h3>HTML form field adjust frame width<\/h3>\n<p>If you want to change this frame, you can use the appropriate <abbr title=\"Cascading Style Sheets\">CSS<\/abbr> statement. To do this, insert the following CSS code between the <strong>head<\/strong> tags and the <strong>style<\/strong> tags of the HTML file:<\/p>\n<pre><code>input, textarea {\r\n    border-width:5px;\r\n}<\/code><\/pre>\n<p>This causes a frame of 5px width to be displayed around the input fields. Also the <a title=\"Round corners form field with CSS border-radius\" href=\"https:\/\/da-software.de\/en\/2020\/03\/form-field-with-rounded-corners\/\">display of rounded corners<\/a> is possible. But you can also do this directly on the <em>input<\/em>&#8211; and <em>texttarea<\/em> tags in HMTL code. While the procedure described above applies to all form fields in the respective HTML file, you can use the following procedure to define the frame width individually for each form field.<\/p>\n<pre><code>&lt;input name=\"Name\" style=\"border-width:5px;\" \/&gt;\r\n&lt;textarea name=\"notes\" style=\"border-width:5px;\"&gt;&lt;\/textarea&gt;<\/code><\/pre>\n<p>Or you build a small CSS class that defines the frame width and then assign the class to the respective form field. In the code it looks like this:<\/p>\n<pre><code>.myborders {\r\n    border-width:5px;\r\n}<\/code><\/pre>\n<pre><code>&lt;input class=\"myborders\" name=\"Name\" \/&gt;\r\n&lt;textarea class=\"myborders\" name=\"notes\"&gt;&lt;\/textarea&gt;<\/code><\/pre>\n<p>The following two pictures show a comparison of an input field with a frame and without a border. If you had chosen a white background in this case, the input field would not be directly visible in the browser.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_2656\" aria-describedby=\"caption-attachment-2656\" style=\"width: 347px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2656 size-full\" title=\"Form field with frame\" src=\"\/wp-content\/uploads\/2020\/03\/online-form-field-border-width.png\" alt=\"Screenshot of an online form field with border width setting\" width=\"347\" height=\"336\" srcset=\"\/wp-content\/uploads\/2020\/03\/online-form-field-border-width.png 347w, \/wp-content\/uploads\/2020\/03\/online-form-field-border-width-300x290.png 300w\" sizes=\"auto, (max-width: 347px) 100vw, 347px\" \/><figcaption id=\"caption-attachment-2656\" class=\"wp-caption-text\">Example of a web form with form fields with border width setting<\/figcaption><\/figure>\n<figure id=\"attachment_2658\" aria-describedby=\"caption-attachment-2658\" style=\"width: 338px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2658 size-full\" title=\"Form field without frame\" src=\"\/wp-content\/uploads\/2020\/03\/online-form-field-border-width-2.png\" alt=\"Screenshot of an online form field without border width setting\" width=\"338\" height=\"337\" srcset=\"\/wp-content\/uploads\/2020\/03\/online-form-field-border-width-2.png 338w, \/wp-content\/uploads\/2020\/03\/online-form-field-border-width-2-300x300.png 300w, \/wp-content\/uploads\/2020\/03\/online-form-field-border-width-2-150x150.png 150w, \/wp-content\/uploads\/2020\/03\/online-form-field-border-width-2-100x100.png 100w\" sizes=\"auto, (max-width: 338px) 100vw, 338px\" \/><figcaption id=\"caption-attachment-2658\" class=\"wp-caption-text\">Example of a web form with form fields with default border width setting<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>Instead of the property <strong>border-width<\/strong> you can also use <strong>border<\/strong>. <em>border-width<\/em> refers directly to the width, while the <em>border<\/em> property is more general. Behind <em>border<\/em> you can specify other properties, such as whether the border should be dashed or dotted.<\/p>\n<h3>HTML form field Remove frame width<\/h3>\n<p>If you want to completely remove the border or frame from the form fields; well, then it&#8217;s quite simple. You use the above code and set the property <strong><em>border-width:0<\/em><\/strong> or throw this CSS property directly out.<\/p>\n<h3>change border-width of form fields with editors<\/h3>\n<p>If you don&#8217;t want to bother with HTML and CSS, you can use an appropriate editor like the <a title=\"Create online application forms\" href=\"https:\/\/da-software.de\/en\/software\/da-formmaker\/\" target=\"_blank\" rel=\"noopener noreferrer\">DA-FormMaker<\/a> to adjust the frame width.<\/p>\n<figure id=\"attachment_2654\" aria-describedby=\"caption-attachment-2654\" style=\"width: 693px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/da-software.de\/en\/software\/da-formmaker\/\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2654 size-full\" title=\"Configure the border width of the form fields\" src=\"\/wp-content\/uploads\/2020\/03\/online-form-border-width-setting.png\" alt=\"Screenshot: Set width of border in the form field\" width=\"693\" height=\"593\" srcset=\"\/wp-content\/uploads\/2020\/03\/online-form-border-width-setting.png 693w, \/wp-content\/uploads\/2020\/03\/online-form-border-width-setting-300x257.png 300w, \/wp-content\/uploads\/2020\/03\/online-form-border-width-setting-600x513.png 600w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/a><figcaption id=\"caption-attachment-2654\" class=\"wp-caption-text\">DA-FormMaker setting for border width in the online application form<\/figcaption><\/figure>","protected":false},"excerpt":{"rendered":"<p>This article explains how to customize the margins and borders of form fields to give them a unique design.<\/p>\n","protected":false},"author":2,"featured_media":667,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[20],"tags":[173,172,175,111,125,114,127],"class_list":["post-2649","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-and-tricks","tag-border-en","tag-css-en","tag-form-field","tag-internet-form","tag-online-form","tag-tutorial-en","tag-website-form"],"_links":{"self":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/posts\/2649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/comments?post=2649"}],"version-history":[{"count":0,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/posts\/2649\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/media\/667"}],"wp:attachment":[{"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/media?parent=2649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/categories?post=2649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/da-software.net\/en\/wp-json\/wp\/v2\/tags?post=2649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}