{"id":1043,"date":"2010-09-14T14:22:43","date_gmt":"2010-09-14T13:22:43","guid":{"rendered":"http:\/\/www.hinnerup.net\/?p=1043"},"modified":"2011-05-27T11:45:36","modified_gmt":"2011-05-27T10:45:36","slug":"css3-og-intellisense-til-css3","status":"publish","type":"post","link":"https:\/\/www.hinnerup.net\/en\/permanent\/2010\/09\/14\/css3-og-intellisense-til-css3\/","title":{"rendered":"CSS3 and Intellisense for CSS3"},"content":{"rendered":"<p>This post will focus on CSS3, and later how to get Visual Studio to recognize CSS3 attributes.<br \/>\nThe CSS3 attributes we will focus on will be: border-radius and box-shadow.<br \/>\nCSS3 isn&#8217;t finalized yet, so it&#8217;s always a good idea to use browser specific tags, such as &#8220;-o-box-shadow, -moz-box-shadow, -webkit-box-shadow&#8221;.<br \/>\nThese will be use in the rest of this post, but not be part of the code-examples.<br \/>\n<em>Note: As of writing this article, Internet Explorer doesn&#8217;t support CSS3 at all, yet.<\/em><\/p>\n<p>Lets begin with a simple unstyled button:<br \/>\n<input type=\"button\" value=\"Button\" \/><\/p>\n<p>Lets start by rounding the corners using the border-radius attribute:<\/p>\n<pre lang=\"css\">.button1\r\n{\r\n   border-radius: 6px \/ 4px;\r\n   \/* alternativ: border-radius: 6px 6px 6px 6px \/ 4px 4px 4px 4px *\/\r\n}<\/pre>\n<p><input style=\"padding:4px; border-radius: 6px \/ 4px; -o-border-radius: 6px \/ 4px; -moz-border-radius: 6px \/ 4px; -webkit-border-radius: 6px \/ 4px;\" type=\"button\" value=\"Knap\" \/><\/p>\n<p>The syntax for &#8220;border-radius&#8221; is similar to the other &#8220;border&#8221;-attributes. The edge in each corner is &#8220;pulled&#8221; down over an invisible circle, which has the defined radius. If you, as I have chosen here, use &#8220;\/&#8221; then the circle will have 2 radii, and thus become oval.<br \/>\nThe complete syntax can be found <a href=\"http:\/\/www.w3.org\/TR\/css3-background\/#the-border-radius\">here<\/a>.<\/p>\n<p>Lets try &#8220;box-shadow&#8221;:<\/p>\n<pre lang=\"css\">.button2\r\n{\r\n   background-color:#606EA6;\r\n   border:1px solid #3B4466;\r\n   color:#FFFFFF;\r\n   box-shadow:0 3px 3px #8CA0F2 inset, 0 -5px 2px #3B4466 inset, 2px 2px 3px black;\r\n}<\/pre>\n<p><input style=\"padding:4px; background-color: #606ea6; border: 1px solid #3B4466; color: #ffffff; box-shadow: 0 3px 3px #8CA0F2 inset, 0 -5px 2px #3B4466 inset, 2px 2px 3px black; -o-box-shadow: 0 3px 3px #8CA0F2 inset, 0 -5px 2px #3B4466 inset, 2px 2px 3px black; -moz-box-shadow: 0 3px 3px #8CA0F2 inset, 0 -5px 2px #3B4466 inset, 2px 2px 3px black; -webkit-box-shadow: 0 3px 3px #8CA0F2 inset, 0 -5px 2px #3B4466 inset, 2px 2px 3px black; border-radius: 6px \/ 4px; -o-border-radius: 6px \/ 4px; -moz-border-radius: 6px \/ 4px; -webkit-border-radius: 6px \/ 4px;\" type=\"button\" value=\"Knap\" \/><\/p>\n<p>The &#8220;box-shadow&#8221; attribute allows an unlimited amount of shadows, as long as they are comma-separated. On the button above, we thus add 3 shadows. The first 2 parameters define horizontal\/vertical placement of the shadow; third param defines how strong a blur effect the shadow should have, where 0 is &#8220;no blur&#8221;. Then the color is defined, and &#8220;inset&#8221; (can be left out) defines that the shadow should be inside the element, as opposed to the outside.<\/p>\n<p>So how do we get Visual Studio to recognize these new attributes?<br \/>\n<em>(If you are not comfortable messing with the Windows registry, you might wanna skip this step.)<\/em><br \/>\nVisual Studio keeps the existing templates in your Visual Studio installation folder, in the subfolder: \\Common7\\Packages\\1033\\schemas\\CSS<br \/>\nTake a copy of css21.xml and call the new file css3draft.xml. Open the file and find a section called &#8220;Edges Properties&#8221;.<\/p>\n<p>Insert 2 new nodes with the following:<\/p>\n<pre lang=\"xml\">\r\n<cssmd:property-def _locID=\"box-shadow\" _locAttrData=\"description,syntax\" type=\"composite\"\r\n            description=\"Attaches one or more drop-shadows to the box\"\r\n            syntax=\"inset? &amp;&amp; [ length{2,4} &amp;&amp; color? ] [ , inset? &amp;&amp; [ length{2,4} &amp;&amp; color? ]*\" \/>\r\n\r\n<cssmd:property-def _locID=\"border-radius\" _locAttrData=\"description,syntax\" type=\"composite\"\r\n            description=\"Defines the radii of a quarter ellipse that defines the shape of the corners of the outer border edge of an element\"\r\n            syntax=\"[ length | percentage ]{1,4} [ \/ [ length | percentage ]{1,4} ]?\" \/>\r\n<\/pre>\n<p>These define our 2 new CSS3 attributes.<\/p>\n<p>Run regedit.exe and search through HKEY_LOCAL_MACHINE for a key (and only keys!) with the GUID: {A764E895-518D-11d2-9A89-00C04F79EFC3}<br \/>\nYou have found the correct GUID if it has a subkey by the name &#8220;Schemas&#8221; (and still remain in the HKEY_LOCAL_MACHINE tree).<br \/>\nThis subkey probably contains keys named &#8220;Schemas 1&#8221; up to &#8220;Schema 4&#8221;<br \/>\nMake a key by the name &#8220;Schema 5&#8221; and two strings with the names &#8220;File&#8221; and &#8220;Friendly Name&#8221;.<br \/>\nSet &#8220;File&#8221; to css3draft.xml and &#8220;Friendly Name&#8221; to whatever you want, for example &#8220;CSS 3 Draft&#8221;.<\/p>\n<p>The styles menubar in Visual Studio will now have an extra value in it&#8217;s drop-down list of CSS schemas.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.hinnerup.net\/wp-content\/uploads\/2010\/09\/2010-09-14_1459.png\" alt=\"Visual Studio Style Menu Bar\" title=\"Visual Studio Style Menu Bar\" width=\"306\" height=\"29\" class=\"alignnone size-full wp-image-1110\" srcset=\"https:\/\/www.hinnerup.net\/wp-content\/uploads\/2010\/09\/2010-09-14_1459.png 306w, https:\/\/www.hinnerup.net\/wp-content\/uploads\/2010\/09\/2010-09-14_1459-300x28.png 300w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>This post will focus on CSS3, and later how to get Visual Studio to recognize CSS3 attributes. The CSS3 attributes we will focus on will be: border-radius and box-shadow. CSS3 isn&#8217;t finalized yet, so it&#8217;s always a good idea to use browser specific tags, such as &#8220;-o-box-shadow, -moz-box-shadow, -webkit-box-shadow&#8221;. These will be use in the [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,7,4],"tags":[],"class_list":["post-1043","post","type-post","status-publish","format-standard","hentry","category-misc","category-words_of_advice","category-programming"],"_links":{"self":[{"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/posts\/1043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/comments?post=1043"}],"version-history":[{"count":84,"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/posts\/1043\/revisions"}],"predecessor-version":[{"id":1456,"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/posts\/1043\/revisions\/1456"}],"wp:attachment":[{"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/media?parent=1043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/categories?post=1043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hinnerup.net\/en\/wp-json\/wp\/v2\/tags?post=1043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}