{"id":765,"date":"2012-04-29T18:09:47","date_gmt":"2012-04-30T01:09:47","guid":{"rendered":"http:\/\/virendrachandak.wordpress.com\/?p=765"},"modified":"2012-07-29T00:32:33","modified_gmt":"2012-07-29T07:32:33","slug":"css-important-declarations","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/","title":{"rendered":"CSS !important Declarations"},"content":{"rendered":"<p>Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn&#8217;t knew what it was and had never used it. So than I did my research on it and decided to write a post about it. In this article I will discuss what it is, how it is used, when to use it, etc<\/p>\n<div style=\"padding-top:20px;\">\n<h3>What is !important?<\/h3>\n<p>The !important is a key word which is added to the end of the CSS value to give it more weight. In CSS the rules are applied to elements in a cascading manner.<\/p>\n<ol>\n<li>Find all the declarations that apply to the element in question.<\/li>\n<li>The order in which the styles are applied based on importance and origin. The weight of style sheets are, from least weight to highest weight, first user agent styles, than user, than author style sheets, !important author styles and the height weight is for the !important user styles.<\/li>\n<li>The more specific a selector is, the higher weight it will get. e.g., a style on &#8220;div.main p&#8221; will have a higher precedence than one just on the &#8220;p&#8221; tag.<\/li>\n<li>The rules work in top to bottom order. Rules that are defined later in the document tree have higher precedence than those defined earlier. Also, if rules are imported from style sheet then they are considered before the rules which are directly in the style sheet.<\/li>\n<\/ol>\n<p>The !important is used to force the style to an element and not be overridden by the cascading CSS. When the !important is used that rule gets more weight than it naturally has.<\/p>\n<\/div>\n<p><!--more--><\/p>\n<div style=\"padding-top:20px;\">\n<h3>How to use !important?<\/h3>\n<p>The !important declaration is a keyword that can be added at the end of any CSS property\/value.<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n#example{\r\ncolor:#000 !important;\r\n}\r\n\r\n#container #example{\r\ncolor:#666;\r\n}\r\n<\/pre>\n<p>In this example we have first have a rule to make the color of text for the element with id example to be black (#000) with !important. Then we have another rule to make the color of text for the element (#example) to be grey(#666). So now the color of the text of the element (#example) would be black and not grey because of the !important declaration. In case we didn&#8217;t use the !important then the color would have been grey.<\/p>\n<\/div>\n<div style=\"padding-top:20px;\">\n<h3>When to use it?<\/h3>\n<p>I think the !important declarations <strong>should not be used unless its is absolutely necessary<\/strong>. Using !important breaks the natural cascading effect of the style sheets. It also will make you code difficult to maintain. I have never used !important declarations. However, there are certain conditions where you will have to use !important.<\/p>\n<div style=\"font-weight:bold;\">Override Inline Styles in user-generated content<\/div>\n<p>If users can add content using the WYSIWYG editors then they can format the content. Also, if you allow the users to add html code they can also specify inline styles to the text. However, each user can make it different and if would not be consistent with your site. So to prevent certain formatting (like background, text color, size etc) you can use !important in your style sheet and as the !important declaration in author style sheet overrides the inline style your content would be consistently displayed for all users-generated content.<\/p>\n<div style=\"font-weight:bold;\">Temporarily fix an urgent issue<\/div>\n<p>If there is some CSS issue in your code and you want to make sure that the a particular style is applied you can use !important to temporarily fix the issue on the live site until you find out a better way(which might take some time). After adding the !important on live site you should work on modifying your rules in order to avoid !important and once you have the fix you can update the code on live site.<\/p>\n<div style=\"font-weight:bold;\">Print stylesheets<\/div>\n<p>The !important declaration can also be used in a print style sheets to make sure that the styles will be applied and not overridden by anything else.<\/p>\n<\/div>\n<div style=\"padding-top:20px;\">\n<h3>Conclusion<\/h3>\n<p>!important declarations should be avoided as long as possible until absolutely necessary and there is no other alternative. You should not use !important tags without giving it a forethought. It should be used only in special cases and not always. I personally have never had to use !important declarations.<\/p>\n<\/div>\n<div style=\"padding-top:30px;\">\n<p><strong>Related Articles<\/strong>:<\/p>\n<ul>\n<li><a title=\"What does !important mean in CSS?\" href=\"http:\/\/webdesign.about.com\/od\/css\/f\/blcssfaqimportn.htm\" rel=\"external nofollow\" target=\"_blank\">What does !important mean in CSS?<\/a><\/li>\n<li><a title=\"Using !important with CSS\" href=\"http:\/\/www.electrictoolbox.com\/using-important-css\/\" rel=\"external nofollow\" target=\"_blank\">Using !important with CSS<\/a><\/li>\n<li><a title=\"!important rules\" href=\"http:\/\/www.w3.org\/TR\/CSS2\/cascade.html#important-rules\" rel=\"external nofollow\" target=\"_blank\">!important rules<\/a><\/li>\n<li><a title=\"Everything You Need to Know About !important CSS Declarations\" href=\"http:\/\/www.impressivewebs.com\/everything-you-need-to-know-about-the-important-css-declaration\/\" rel=\"external nofollow\" target=\"_blank\">Everything You Need to Know About !important CSS Declarations<\/a><\/li>\n<li><a title=\"!important CSS Declarations: How and When to Use Them\" href=\"http:\/\/coding.smashingmagazine.com\/2010\/11\/02\/the-important-css-declaration-how-and-when-to-use-it\/\" rel=\"external nofollow\" target=\"_blank\">!important CSS Declarations: How and When to Use Them<\/a><\/li>\n<li><a title=\"!important Declarations\" href=\"http:\/\/reference.sitepoint.com\/css\/importantdeclarations\" rel=\"external nofollow\" target=\"_blank\">!important Declarations<\/a><\/li>\n<li><a title=\"The importance of the !important CSS declaration\" href=\"http:\/\/www.webcredible.co.uk\/user-friendly-resources\/web-dev\/css-important.shtml\" rel=\"external nofollow\" target=\"_blank\">The importance of the !important CSS declaration<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn&#8217;t knew what it was and had never used it. So than I did my research on it and decided to write a post about it. In this article I will discuss what it is, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[142,8],"tags":[14,26,9,40,64],"class_list":["post-765","post","type-post","status-publish","format-standard","hentry","category-css","category-web-development","tag-important","tag-cascading-style-sheets","tag-css","tag-html-element","tag-style-sheets"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CSS !important Declarations - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn&#039;t knew what it was and had never\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS !important Declarations - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn&#039;t knew what it was and had never\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2012-04-30T01:09:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-07-29T07:32:33+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"CSS !important Declarations\",\"datePublished\":\"2012-04-30T01:09:47+00:00\",\"dateModified\":\"2012-07-29T07:32:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/\"},\"wordCount\":746,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"!important\",\"Cascading Style Sheets\",\"CSS\",\"HTML element\",\"Style Sheets\"],\"articleSection\":[\"CSS\",\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/\",\"name\":\"CSS !important Declarations - Virendra's TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2012-04-30T01:09:47+00:00\",\"dateModified\":\"2012-07-29T07:32:33+00:00\",\"description\":\"Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn't knew what it was and had never\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/css-important-declarations\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CSS\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CSS !important Declarations\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS !important Declarations - Virendra's TechTalk","description":"Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn't knew what it was and had never","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/","og_locale":"en_US","og_type":"article","og_title":"CSS !important Declarations - Virendra's TechTalk","og_description":"Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn't knew what it was and had never","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2012-04-30T01:09:47+00:00","article_modified_time":"2012-07-29T07:32:33+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"CSS !important Declarations","datePublished":"2012-04-30T01:09:47+00:00","dateModified":"2012-07-29T07:32:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/"},"wordCount":746,"commentCount":0,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["!important","Cascading Style Sheets","CSS","HTML element","Style Sheets"],"articleSection":["CSS","Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/","name":"CSS !important Declarations - Virendra's TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2012-04-30T01:09:47+00:00","dateModified":"2012-07-29T07:32:33+00:00","description":"Recently I came across lot of code using CSS !important declaration. I had known that this declaration existed but I didn't knew what it was and had never","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/css-important-declarations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"CSS","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/css\/"},{"@type":"ListItem","position":3,"name":"CSS !important Declarations"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-cl","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":117,"url":"https:\/\/www.virendrachandak.com\/techtalk\/optimizing-websites\/","url_meta":{"origin":765,"position":0},"title":"Optimizing \/ Speeding up websites","author":"Virendra Chandak","date":"April 14, 2011","format":false,"excerpt":"In this article I will list a few things that can be done to speed up website. I will give just brief description on each topic and give links to find more details on those topics. I have used tools like Google's Page Speed, YSlow, Audits Tab in Chrome\u00a0Developer\u00a0Tools. 1.\u2026","rel":"","context":"In &quot;Optimization Tips&quot;","block_context":{"text":"Optimization Tips","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/optimization-tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1650,"url":"https:\/\/www.virendrachandak.com\/techtalk\/css-triangles-arrows-designs\/","url_meta":{"origin":765,"position":1},"title":"How to create Triangles using CSS","author":"Virendra Chandak","date":"December 15, 2013","format":false,"excerpt":"Many times we come across cases where we want to have triangles, arrows or simple shapes on a site. Usually we use images to add arrows or triangles. However, this can be easily achieved by just using CSS and no need of images at all. In this post we will\u2026","rel":"","context":"In &quot;CSS&quot;","block_context":{"text":"CSS","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/css\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1032,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-add-css-classes-to-wordpress-menu-item\/","url_meta":{"origin":765,"position":2},"title":"How to add CSS classes to WordPress menu item","author":"Virendra Chandak","date":"November 24, 2012","format":false,"excerpt":"Recently I wanted to add some customization to some of my menu items. So I decided to add a CSS class to those particular menu items. I could modify my theme code and add some custom functions to do that. However, I first decided to explore the WordPress options and\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/wordpress\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virendrachandak.com\/techtalk\/wp-content\/uploads\/2012\/07\/WordPress-add-CSS-Classes-to-menu-item.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virendrachandak.com\/techtalk\/wp-content\/uploads\/2012\/07\/WordPress-add-CSS-Classes-to-menu-item.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virendrachandak.com\/techtalk\/wp-content\/uploads\/2012\/07\/WordPress-add-CSS-Classes-to-menu-item.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virendrachandak.com\/techtalk\/wp-content\/uploads\/2012\/07\/WordPress-add-CSS-Classes-to-menu-item.png?resize=700%2C400 2x, https:\/\/i0.wp.com\/www.virendrachandak.com\/techtalk\/wp-content\/uploads\/2012\/07\/WordPress-add-CSS-Classes-to-menu-item.png?resize=1050%2C600 3x"},"classes":[]},{"id":733,"url":"https:\/\/www.virendrachandak.com\/techtalk\/sticky-header-and-footer-using-css\/","url_meta":{"origin":765,"position":3},"title":"Sticky Header and Footer using CSS","author":"Virendra Chandak","date":"February 20, 2012","format":false,"excerpt":"In some sites we want to keep the Header and Footer always visible and fixed to top and bottom of the screen respectively. In this article I will show how we can implement the sticky (or fixed) header and footer using only HTML and CSS. To create a layout with\u2026","rel":"","context":"In &quot;CSS&quot;","block_context":{"text":"CSS","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/css\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1132,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-remove-wordpress-version-parameter-from-js-and-css-files\/","url_meta":{"origin":765,"position":4},"title":"How to remove WordPress version parameter from JS and CSS files","author":"Virendra Chandak","date":"September 9, 2012","format":false,"excerpt":"In my last post I mentioned how we can remove WordPress version number from the page source and RSS feeds. However, they are not the only places where we can identify the WordPress version number. Many CSS and JS files in the WordPress also have the WordPress version number appended\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/wordpress\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":631,"url":"https:\/\/www.virendrachandak.com\/techtalk\/make-a-div-stick-to-top-when-scrolled-to\/","url_meta":{"origin":765,"position":5},"title":"Make a div stick to top when scrolled to","author":"Virendra Chandak","date":"January 1, 2012","format":false,"excerpt":"There are times when you would want to display a bar at the top of the page when user scrolls on the page and it should go back to its original position when the user scrolls back up. This is particularly useful when you want to add say a share\u2026","rel":"","context":"In &quot;Functionality&quot;","block_context":{"text":"Functionality","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/functionality\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=765"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/765\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}