Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.97 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. ul {
  6.     display: table;
  7. width:100%;
  8.  
  9. margin:0;
  10. padding:0;
  11.  
  12. }
  13. li {
  14. display:table-cell;
  15. }
  16. a {
  17. display:block;
  18.     width: auto;
  19.     text-decoration: none;
  20. font-size:20px;
  21. text-align:center;
  22.     color: white;
  23.     background-color: #B71C52;
  24.     padding: 0.2em 0.6em;
  25.  
  26. }
  27.  
  28. a:hover {
  29.     background-color: fuchsia;
  30. }
  31.  
  32.  
  33. </style>
  34.  
  35. <ul>
  36. <li><a href="#">Link one</a></li>
  37. <li><a href="#">Link two</a></li>
  38. <li><a href="#">Link three</a></li>
  39. <li><a href="#">Link four</a></li>
  40. </ul>
  41. </head>
  42. <body>
  43.  
  44.  
  45.  
  46. <p>In the example above, we let the ul element and the a element float to the left.
  47. li elements will be displayed as inline elements (no line break before or after the element). This forces the list to be on one line.
  48. The ul element has a width of 100% and each hyperlink in the list has a width of 6em (6 times the size of the current font).
  49. We add some colors and borders to make it more fancy.
  50. </p>
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement