User Tools

Site Tools


en:web_development:lists:menus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:web_development:lists:menus [2021/12/02 14:04]
mag [Links]
en:web_development:lists:menus [2023/08/16 09:33] (current)
Line 1: Line 1:
-====== Web Development Lesson - Lists ======+====== Web Development Lesson - Lists ======
 ===== Menus ===== ===== Menus =====
 +==== Objectives ====
 +In this exercise you will display lists as menus, create links to other pages and learn some basic layout properties.
 ==== Setup ==== ==== Setup ====
   * In this activity, we're going to start building a web site.   * In this activity, we're going to start building a web site.
Line 12: Line 14:
 ==== Sidebar ==== ==== Sidebar ====
   * Many web sites use a sidebar for navigation or links. It's essentially a list of links, so a list structure is most effective.   * Many web sites use a sidebar for navigation or links. It's essentially a list of links, so a list structure is most effective.
-  * Let's create a list of the activities we've done so far. Add this code inside the <html><body></html> tags.+  * Let's create a list of the activities we've done so far. Add this code to 'menu.html' inside the <html><body></html> tags.
 <code>    <ul> <code>    <ul>
         <li>Funny Story</li>         <li>Funny Story</li>
Line 52: Line 54:
   * Inline elements sit side by side horizontally. Examples include <html><strong></html>, <html><em></html> and <html><span></html>.   * Inline elements sit side by side horizontally. Examples include <html><strong></html>, <html><em></html> and <html><span></html>.
   * These can be controlled, though, so you can make list items sit side by side.   * These can be controlled, though, so you can make list items sit side by side.
-  * +  * Add the following code to your 'style.css'
 +<code>li { 
 +    display: inline; 
 +}</code> 
 +  * <html>display</html> has many options that all present the element as either block or inline (or not shown) depending on the elements around them. By setting our list items <html>inline</html> we're telling them to display horizontally. 
 +  * Open your 'menu.html' in Live Server and check the results. 
 +  * If you're still seeing the bullets in your menu, it doesn't look as good, so let's remove them again. 
 +<code>ul { 
 +    list-style-type: none; 
 +}</code> 
 +  * Just for fun, let's make it look a little prettier. 
 +<code>ul { 
 +    list-style-type: none; 
 +    background-color: darkgoldenrod; 
 +    padding-top: 10px; 
 +    padding-bottom: 10px; 
 +
 + 
 +li { 
 +    display: inline; 
 +    border-right: solid 1px yellow; 
 +
 + 
 +a { 
 +    text-decoration: none; 
 +    color: #ccc; 
 +    padding: 10px; 
 +    font-weight: 700; 
 +    font-family: arial; 
 +}</code> 
 +  * You might not understand all these styles. We'll look at padding and borders in the next lesson on tables. Similarly, we'll look at different ways of specifying colours later in the course. 
 +  * Feel free to adjust some of these values to see what they do. 
 + 
 +==== Final Code ==== 
 +  * [[https://techschool.murraygunn.id.au/webdev/classes/proyecto/1/en.php|menu.html]] 
 +  * [[https://techschool.murraygunn.id.au/webdev/classes/proyecto/1/style.php|style.css]] 
 +  * [[https://techschool.murraygunn.id.au/webdev/classes/proyecto/1/menu.html|result]]
  
-[[en:web_development:lists:javascript|Next: Javascript Lists]]+[[en:web_development:lists:javascript|Next: Javascript]]
en/web_development/lists/menus.1638482694.txt.gz · Last modified: 2023/08/16 09:33 (external edit)