As a Web designer, you use some bits of HTML, CSS, and JavaScript code frequently but not often enough to commit to memory. The following HTML code, CSS style, and JavaScript hints are handy when you are adding special elements such as null links, meta tags, and entities to your pages. Use these HTML, CSS, and JavaScript code hints in Code view, the Properties inspector, and your CSS style sheets.
HTML Code Hint | Code Shortcut |
---|---|
Create a null link | # or javascript:; or javascript:void(0) as in<a href="#">link</a> <a href="javascript:;">link</a> <a href="javascript:void(0)">link</a> |
Create named anchor link | Link to Target <a href="#anchorname">link</a> Target <a name="anchorname"></a> |
Create link to named anchor in another page | <a href="otherpage.html#anchorname">link</a> |
Insert line break | <br /> |
Close window JavaScript | <a href="javascript:window.close();">Close This Window</a> |
Revisit after x days meta tag | <meta name="revisit-after" content="5 days" /> |
No cache meta tag | <meta http-equiv="pragma" content="no-cache"> |
Meta link to home page | <link rel="Index" href="index.html" /> |
Meta link to sitemap page | <link rel="Site Map" href="sitemap.html" /> |
Meta link to shortcut icon | <link rel="Shortcut Icon" href="favicon.ico" /> |
Meta link to shortcut icon using GIF instead of ICO | <link rel="Shortcut Icon" type="image/gif" href="favicon.gif" /> |
Link to external JS file | <script src="myjsfile.js" type="text/javascript"></script> |
Link to external CSS | <link rel="stylesheet" type="text/css" href="css/ie.css" media="screen"/> |
Import@ link to external CSS | <style media="all" type="text/css"> @import "css/all.css"; </style> |
CSS link for IE browsers less than IE 7 | <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="ie.css" media="all"/><![endif]→ |
Insert an image with ALT attribute | <img src="images/myfile.png" alt="My File" /> |
Empty ALT attribute for image | <img src="images/myfile.png" alt="" /> |
Entity to add blank space | or   |
Entity to add copyright | © or © |
Entity to add trademark | ™ or ™ |
Entity to add ampersand | & or & |
Add NoScript tags | <noscript> |
Link targets | _blank _new _self _parent _top |
Apply CSS custom style with SPAN tags | <span class="stylename"> |
Comment tags in HTML and JavaScript | <!-- Your comment here //→ |
Comment tags in CSS | /* Your comment here */ |
Structure of a CSS tag redefine style | tag { attribute: value; } |
Structure of a CSS ID style | #ID { attribute: value; } |
Structure of a CSS custom style | .stylename { attribute: value; } |
CSS for link styles | a:link { attribute: value; } a:visited { attribute: value; } a:hover { attribute: value; } a:active { attribute: value;; } |
dummies
Source:http://www.dummies.com/how-to/content/html-css-and-javascript-code-hints.html
No comments:
Post a Comment