In: Computer Science
****** please don't copy and paste and don't use handwriting
****** I need a unique answer
Q1: Write HTML code to get the following output that include the following elements.
The title is: Favorite Books
Large heading with text “Your Favorite Books”
Form that has 3 input values (two text boxes and one drop down list)
Drop-down list contains the following options,
Wiley
Mc-Graw Hill
Submit information to “books.php” using GET request.
Q2:Display a simple message "Welcome" on your demo webpage. When the user hovers over the message, a popup should be displayed with a message "Welcome to our new WebPage!!!".
Q3:
Create XHTML and CSS file to show your information. Style the table to match the on in the picture. You are allowed to choose your preferred colors; however, you cannot change the style of the table.
The table must be centered in the page
Heading font is Times New Roman
Text in table cells must be centered
Solution :
(1) In this part i have used 2 textboxes and 1 Dropdown List with 3 inputs. And also a submit button is used with get method and the button action is set to books.php when clicked. The heading of the page is favourite books as required.The code and output is given below:
Code :
<!DOCTYPE html>
<html>
<head>
<title>Favourite Books</title>
</head>
<body>
<center>
<h1>YOUR FAVOURITE BOOKS</h1>
<form action="books.php" method="get">
<label for="t1">TextBox1 :</label>
<input type="text" id="t1"
name="t1"><br><br>
<label for="t2">Textbox2 :</label>
<input type="text" id="t2"
name="t2"><br><br>
<label for="Ddown">Dropdown List :</label>
<select id="Ddown" name="Ddown">
<option value="Pearson">Pearson</option>
<option value="Wiley">Wiley</option>
<option value="Mc-Graw Hill">Mc-Graw
Hill</option>
</select><br><br><br><br>
<input type="submit" value="Submit">
</form>
</center>
</body>
</html>
Output :
All the things are aligned in center but since i have cropped the screenshot it may not seem in center.You can also see the heading here at top left corner.
(2) I have used Tooltip o display a pop message while hovering on the message.Tooltip used to gove extra in formation when user hover over some elements.Html and Css is used.The code and output is below:
Code :
<!DOCTYPE html>
<html>
<style>
.tooltip {
position: relative;
display: inline-block;
font-size : 20px;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 150px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
top: -5px;
left: 105%;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
<body style="text-align:center;">
<div class="tooltip">Welcome
<span class="tooltiptext">Welcome to our new
webpage</span>
</div>
</body>
</html>
Output:
It should display like this when we hover on welcome.The message with blackground is the popup message.
(3) As for this part you have not provided the picture of the table as mentioned in the question for us to match the table requirements.So i am providing you the table with the remaining conditions.
Code:
<!DOCTYPE html>
<html>
<head>
<style>
#customers {
font-family: "Times New Roman", Times, serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
padding: 8px;
text-align:center;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
text-align:center;
}
</style>
</head>
<body>
<center>
<table id="customers">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Person1</td>
<td>123</td>
<td>US</td>
</tr>
<tr>
<td>Person2</td>
<td>456</td>
<td>Mexico</td>
</tr>
<tr>
<td>Person3</td>
<td>789</td>
<td>Austria</td>
</tr>
</table>
</center>
</body>
</html>
Output:
The table will be printed in the center of the webpage for sure. Just for the better view of the table i have cropped it.The heading of the table is in TImes New roman.Heading is in the center with all the other entries.I have also used Css to get a hover effect on rows.
Do mention if any problem.
Thanks.I hope you like the code.PLEASE VOTE UP ;)