In: Computer Science
In this weeks assignment you will be sharing your favorite recipe with us via a web page. The recipe is of your choice and does not have to be a culinary creation, it can be anything! Your web page style and aesthetic should compliment your recipe, do some research for design inspiration if you cannot think of anything.
Requirements:
recipeIndex.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Page Title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="recipeMain.css" type="text/css" rel="stylesheet">
</head>
<body onload=insert_data()>
<script type=text/javascript src="main.js"></script>
<div class="header">
<h1>My Recipes</h1>
<p>A food website created by me.</p>
</div>
<div class="navbar">
<a href="#">Home</a>
<a href="#">Gallery</a>
<a href="#">Profile</a>
</div>
<div class="row">
<div class="side">
<h2>Today's special</h2>
<h5>Cheese Burst Mushroom Pizza</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<h2>INGREDIENTS:</h2>
<table id="myTable">
<thead>
<tr>
<th>Ingredients</th>
<th>Quantity</th>
</tr>
</thead>
<tbody id="datas">
</tbody>
</table>
</div>
<div class="main">
<h2>DIRECTIONS</h2>
<ol>
<li>Preheat oven to 450 degrees F. Lightly coat a baking sheet or pizza pan with olive oil.</li>
<li>Melt butter in a large skillet over medium heat. Add garlic, and cook, stirring frequently, until fragrant, about 1-2 minutes.</li>
<li>Stir in mushrooms and oregano. Cook, stirring occasionally, until mushrooms are tender and browned, about 5-6 minutes; season with salt and pepper, to taste.</li>
<li>Working on a surface, roll out the pizza into a 12-inch-diameter round. Transfer to prepared baking sheet or pizza pan.</li>
<li>Top with mozzarella and mushrooms.</li>
<li>Place into oven and bake for 15-20 minutes, or until the crust is golden brown and the cheeses have melted.</li>
<li>Serve immediately.</li>
</ol>
<br>
<div class="fakeimg"></div>
</div>
</div>
<div class="footer">
<p>Copyright © 20XX contact-(xxx)-xxx-xxxxxx</p>
</div>
</body>
</html>
recipeMain.css:
* {
box-sizing: border-box;
}
/* Style the body */
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
}
/* Header/logo Title */
.header {
padding: 80px;
text-align: center;
background-image: url('header.jpg');
background-size: cover;
color: white;
}
/* Increase the font size of the heading */
.header h1 {
font-size: 40px;
}
/* Style the top navigation bar */
.navbar {
overflow: hidden;
background-color: rgb(104, 42, 104);
}
/* Style the navigation bar links */
.navbar a {
float: left;
display: block;
color: white;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
/* Change color on hover */
.navbar a:hover {
background-color: #ddd;
color: black;
}
/* Column container */
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
}
/* Create two unequal columns that sits next to each other */
/* Sidebar/left column */
.side {
-ms-flex: 30%; /* IE10 */
flex: 30%;
background-color: #f1f1f1;
padding: 20px;
}
/* Main column */
.main {
-ms-flex: 70%; /* IE10 */
flex: 70%;
background-color: white;
padding: 20px;
}
/* Fake image, just for this example */
.main .fakeimg {
background-image: url('pizza2.jpg');
background-size: cover;
width: 100%;
padding: 20px;
height: 400px;
}
.side .fakeimg {
background-image: url('pizza.jpg');
background-size: cover;
width: 100%;
padding: 20px;
}
/* Footer */
.footer {
padding: 10px;
text-align: center;
color: #fff;
background: rgb(48, 1, 45);
}
li{
padding: 10px;
}
td{
padding-bottom: 10px;
}
/* Responsive layout - when the screen is less than 700px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 700px) {
.row {
flex-direction: column;
}
}
/* Responsive layout - when the screen is less than 400px wide, make the navigation links stack on top of each other instead of next to each other */
@media screen and (max-width: 400px) {
.navbar a {
float: none;
width: 100%;
}
}
main.js
var details = [
{ingredients:"olive oil", quantity:"2 tablespoon"},
{ingredients:"unsalted butter", quantity:"2 tablespoon"},
{ingredients:"garlic", quantity:"3 cloves, minced"},
{ingredients:"portebello mushrooms", quantity:"16 ounces, thinly sliced"},
{ingredients:"dried oregano", quantity:"1/2 teaspoon"},
{ingredients:"back pepper", quantity:"as per taste"},
{ingredients:"pizza crust", quantity:"medium size"},
{ingredients:"mozzarella cheese", quantity:"1 ounce slices"},
{ingredients:"cheddar cheese", quantity:"1 cup"}
]
function insert_data(){
var table = document.getElementById("datas");
table.innerHTML="";
var tr="";
details.forEach(x=>{
tr+='<tr>';
tr+='<td>'+x.ingredients+'</td>'+'<td>'+x.quantity+'</td>';
tr+='</tr>';
})
table.innerHTML+=tr;
}
images:
header.jpg
pizza.jpg
pizza2.jpg
output screenshots: