Black Goose Bistro The restaurant The Black Goose Bistro offers casual lunch and dinner fare in a hip atmosphere. The menu changes regularly to highlight the freshest ingredients. Catering You have fun... we'll handle the cooking. Black Goose Catering can handle events from snacks for a meetup to elegant corporate fundraisers. Location and Hours Seekonk, Massachusetts; Monday through Thursday 11am to 9pm, Friday and Saturday, 11am to midnight
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Black Goose Bistro</title> </head> <body> The restaurant The Black Goose Bistro offers casual lunch and dinner fare in a hip atmosphere. The menu changes regularly to highlight the freshest ingredients. Catering You have fun... we'll handle the cooking. Black Goose Catering can handle events from snacks for a meetup to elegant corporate fundraisers. Location and Hours Seekonk, Massachusetts; Monday through Thursday 11am to 9pm, Friday and Saturday, 11am to midnight </body> </html>
在浏览器中打开index.html文件:
图4.4 上述修改后在浏览器中显示的内容
第3步:确定文本元素
语义标记,选择合适的HTML元素,为当前内容进行描述。
练习4-3:
打开index.html文件,并编写以下内容:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Black Goose Bistro</title> </head> <body> <h1>Black Goose Bistro</h1> <h2>The restaurant</h2> <p>The Black Goose Bistro offers casual lunch and dinner fare in a hip atmosphere. The menu changes regularly to highlight the freshest ingredients.</p> <h2>Catering</h2> <p>You have fun... <em>we'll handle the cooking</em>. Black Goose Catering can handle events from snacks for a meetup to elegant corporate fundraisers.</p> <h2>Location and Hours</h2> <p>Seekonk, Massachusetts;</p> <p>Monday through Thursday 11am to 9pm, Friday and Saturday, 11am to midnight</p> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Black Goose Bistro</title> </head> <body> <h1><img src="blackgoose.png" alt="Black Goose Bistro logo" /><br>Black Goose Bistro</h1> <h2>The restaurant</h2> <p>The Black Goose Bistro offers casual lunch and dinner fare in a hip atmosphere. The menu changes regularly to highlight the freshest ingredients.</p> <h2>Catering</h2> <p>You have fun... <em>we'll handle the cooking</em>. Black Goose Catering can handle events from snacks for a meetup to elegant corporate fundraisers.</p> <h2>Location and Hours</h2> <p>Seekonk, Massachusetts;</p> <p>Monday through Thursday 11am to 9pm, Friday and Saturday, 11am to midnight</p> </body> </html>
打开浏览器并显示index.html文件中的内容:
图4.9 在浏览器中显示图片的效果
第5步:使用样式表来改变外观
使用CSS来美化刚才的Black Goose Bistro主页。
练习4-5:
打开编写index.html文件:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Black Goose Bistro</title> <style> body { background-color: #faf2e4; margin: 0 15%; font-family: sans-serif; } h1 { text-align: center; font-family: serif; font-weight: normal; text-transform: uppercase; border-bottom: 1px solid #57b1dc; margin-top: 30px; } h2 { color: #d1633c; font-size: 1em; } </style> </head> <body> <h1><img src="blackgoose.png" alt="Black Goose Bistro logo" /><br>Black Goose Bistro</h1> <h2>The restaurant</h2> <p>The Black Goose Bistro offers casual lunch and dinner fare in a hip atmosphere. The menu changes regularly to highlight the freshest ingredients.</p> <h2>Catering</h2> <p>You have fun... <em>we'll handle the cooking</em>. Black Goose Catering can handle events from snacks for a meetup to elegant corporate fundraisers.</p> <h2>Location and Hours</h2> <p>Seekonk, Massachusetts;</p> <p>Monday through Thursday 11am to 9pm, Friday and Saturday, 11am to midnight</p> </body> </html>