更新時(shí)間:2022-11-09 09:10:44 來(lái)源:動(dòng)力節(jié)點(diǎn) 瀏覽3400次
讓我們創(chuàng)建一些網(wǎng)頁(yè)來(lái)查看實(shí)際生成的網(wǎng)頁(yè)。
在這里,我們正在創(chuàng)建一個(gè)帶有一些 HTML 元素和標(biāo)簽的簡(jiǎn)單網(wǎng)頁(yè)。將一張圖像設(shè)置為背景,并在其上設(shè)置一些文本,如下所示:
HTML 代碼:
<head>
<style>
.card {
max-width: 200px;
margin: auto;
text-align: center;}
#main{
background-image: url('Travel.jpg');
background-repeat: no-repeat;
background-size:cover;
}
.price {
color: blue;
font-size: 18px;
}
.card button {
padding:10px;
color: white;
background-color: green;
text-align: center; }
</style>
</head>
<body id="main">
<h2 style="text-align:center">Place to visit in India</h2>
<div class="card">
<img src="download.jpg" style="width:100%">
<h1><b>Explore Best In India</b></h1>
<h2 class="price">INR 39,990/-</h2>
<h2>
<ul>
<li>Manali</li>
<li>Rushikesh</li>
<li>Chadar Trek</li>
<li>Andaman and Nicobar</li>
<li>Mount Abu</li>
</ul>
</h2>
<p><button>Book Here</button></p>
</div>
</body>
輸出:
在此示例中,我們將創(chuàng)建一個(gè)反饋表單作為網(wǎng)頁(yè)。
HTML 代碼:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
input[type=text], select, textarea {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
margin-top: 4px;
margin-bottom: 10px;
}
input[type=submit] {
background-color:Blue;
padding: 8px 8px;
}
.container {
width:100%;
border-radius: 6px;
background-color: #EFF6F6;
padding: 10px;
}
</style>
</head>
<body>
<h3>We welcome your suggestions</h3>
<div class="container">
<form>
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="Enter Your name">
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" placeholder="Enter Your last name">
<label for="ename">Email</label>
<input type="text" id="ename" name="email" placeholder="Enter Your Email here">
<label for="mobno">Contact No</label>
<input type="text" id="mobno" name="mobno" placeholder="Enter Your Contact Number">
<label for="subject">Feedback</label>
<textarea id="subject" name="subject" placeholder="Give your feedback
"style="height:50px"></textarea>
<input type="submit" value="Send">
</form>
</div>
</body>
</html>
輸出:
在此示例中,我們將創(chuàng)建另一個(gè)網(wǎng)頁(yè),該網(wǎng)頁(yè)將顯示特定網(wǎng)站的主頁(yè)。
HTML 代碼:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
}
body {margin: 0;}
.header {
padding: 10px;
text-align: center;
background: orange;
color: white;
}
.navbar {
overflow: hidden;
background-color: dimgrey;
}
.navbar a {
float: left;
display: block;
color: white;
text-align: center;
padding: 10px 10px;
}
.navbar a.right {
float: right;
}
.navbar a:hover{
background-color: #eee;
color: black;
}
.row {
display: flex;
flex-wrap: wrap;
}
.sidebar {
flex: 10%;
background-color: #f1f1f1;
padding: 20px;
}
.main {
flex: 80%;
background-color: white;
padding: 20px;
}
.logoimg {
height:10%;
float:left;
}
</style>
</head>
<body>
<div class="header">
<div class="logoimg" style=""><img src="cropped-EDUCBA_LOGO.png"></div>
<h1>Welcome to EDUCBA</h1>
</div>
<div class="navbar">
<a >Finance</a>
<a >Data Science</a>
<a >Software Development</a>
<a >Excel</a>
<a >Design</a>
<a href="#" class="right">Login</a>
</div>
<div class="row">
<div class="sidebar">
<h2>Contact US</h2>
<div><img src="Contact.jpg" style="height:100px;"></div>
<h2>Reviews</h2>
<div ><img src="Reviews.jpg" style="height:100px;"></div>
</div>
<div class="main">
<h2>WHO IS EDUCBA?</h2>
<p>Choose your interest area and get certified with our online Courses in Finance, Data Science, Software Development, Excel, Design, Project Management, Personal Development, Marketing and Human Resources..</p>
<br>
<div class="row">
<div class="sidebar">
<h2><u>Certification Courses</u></h2>
<a >Financial Analyst Course - All in One Bundle</a><br>
<a >Marketing Course - All in One Bundle</a><br>
<a >Human Resource Course - All in One Bundle</a><br>
<a >Design Course -All in one Bundle</a> <br>
<a >Excel VBA Course - All in One Bundle</a>
</div>
<div class="sidebar">
<h2><u>Free Courses</u></h2>
<a >Free Course on Data Science</a><br>
<a >Free Course Graphic Design</a><br>
<a >Free Online Excel Course</a><br>
<a >Free Course Digital Marketing</a><br>
<a >Free Course Programming</a>
</div></div></div></div>
</body>
輸出:
以上就是關(guān)于“用HTML進(jìn)行網(wǎng)頁(yè)設(shè)計(jì)的代碼示例大全”的介紹,大家如果對(duì)此比較感興趣,想了解更多相關(guān)知識(shí),不妨來(lái)關(guān)注一下本站的HTML教程,里面還有更豐富的知識(shí)等著大家去學(xué)習(xí),希望對(duì)大家能夠有所幫助哦。
0基礎(chǔ) 0學(xué)費(fèi) 15天面授
有基礎(chǔ) 直達(dá)就業(yè)
業(yè)余時(shí)間 高薪轉(zhuǎn)行
工作1~3年,加薪神器
工作3~5年,晉升架構(gòu)
提交申請(qǐng)后,顧問(wèn)老師會(huì)電話與您溝通安排學(xué)習(xí)
初級(jí) 202925
初級(jí) 203221
初級(jí) 202629
初級(jí) 203743