betoesquivel

Ejercicio CSS2 Web

Jan 27th, 2015
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.35 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Simple HTML/CSS/JS Refactoring</title>
  6. <!-- Latest compiled and minified CSS -->
  7. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
  8. <style type="text/css" media="all">
  9.   .italic { font-style: italic }
  10.   a:visited { color: blue; }
  11.   strong { color: blue; }
  12.   footer {color: aqua; background: blue; padding: 10px;}
  13.   #list1 {
  14.     position: absolute;
  15.     display: block;
  16.     visibility: hidden;
  17.   }
  18. </style>
  19. </head>
  20. <body>
  21. <div class="container">
  22. <h1>Refactor Me!</h1>
  23. <p class="italic">
  24. This page is full of lots of violations of the DRY principle (Don't Repeat Yourself) along with a number of other violations of HTML markup best practices.
  25. </p>
  26. <p class="italic">
  27. Your goal is to refactor the HTML, CSS and JavaScript on this page so that you have:
  28. </p>
  29. <ol>
  30.   <li class="italic"> a clear separation of concerns between HTML, CSS and JavaScript </li>
  31. </ol>
  32. </div>
  33. <a href="#" onclick="cambiar()">Click Here to See Suggested Refactoring Path!</a>
  34. <ol id="list1">
  35.   <li>Refactor <strong>inline styles</strong> (into the head tag or an external stylesheet).</li>
  36.   <li>Refactor <strong>duplication</strong> that exists in the inline style tags.</li>
  37.   <li>Refactor <strong>markup</strong> to use appropriate html elements.</li>
  38.   <li>Refactor <strong>styles</strong> to eliminate the property duplication.</li>
  39.   <li>Refactor <strong>javascript</strong> to eliminate inline click handler.</li>
  40. </ol>
  41. <footer id="note" >
  42.   While there a number of tools available that can assist in making this refactoring easier I want to challenge you to do this refactor with nothing but your brain and a text editor.
  43.   </footer>
  44. </div>
  45. </body>
  46. <script type="text/javascript" charset="utf-8">
  47.   function cambiar(){
  48.     if(document.getElementById('list1').style.visibility === 'hidden') {
  49.       document.getElementById('list1').style.visibility = 'visible';
  50.       // the following line will help hide the whitespace when hidden;
  51.       document.getElementById('list1').style.position = 'relative';
  52.     } else {
  53.       document.getElementById('list1').style.visibility = 'hidden';
  54.       // the following line will help move the blue box when shown
  55.       document.getElementById('list1').style.position = 'absolute';
  56.     }
  57.   }
  58. </script>
  59. </html>
Advertisement
Add Comment
Please, Sign In to add comment