Question

Hello, I am designing a website for my class. I am using HTML/CSS/Jscript. I need to...

Hello,

I am designing a website for my class. I am using HTML/CSS/Jscript. I need to have my text in the body, white. All text and the picture centered but how do I have margins on the left and right side?. I have a figcaption and I dont know have to place it under the picture but I am having a hard time. Can you help me?

Thank you!

HTML

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">


  
<style>
body {
margin: 0 auto;
font-family: Arial, Helvetica, sans-serif;
background: #8E8E8E

}

p.ex1 {
margin: 35px;
}


.content {
   font-size: 17px;
   text-align: center;
}
  
footer {
background-color: dimgrey;
padding: 10px;
text-align: center;
color: #DDD7D7;
  
}  
</style>
</head>
<header>
   <div class="content"></div>
       <a href="home.html">
       <img src="vmoto.gif" alt="vmoto" width="1380" height="200" >
   </a>
</header>
<body>


  
<nav>
<ul>
<li><a class="active" href="index.html">Home</a></li>
<li><a href="mbike.html">Mountain Bike</a></li>
<li><a href="roadbike.html">Road Bike</a></li>
<li><a href="bmx.html">BMX</a></li>
<li><a href="about.html">About</a></li>
</ul>
</nav>

  

<figure>
<img src="bicycle-bike-daylight-100582 (1).jpg" alt="mountain_bike_front"
   class="center">
   <a href="mbike.html"></a>
   <figcaption>Thats right kids, we are now selling THE IronHorse bike. Ain't she a beaut!</figcaption>
   </figure>


  
<section>
<h1>Bike text</h1>
<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>
</section>
<center>
<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>
<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>
<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>
</center>

  
<footer>
<p>Contact Us!

123 Main St.

Anywhere, NC 99999* |

Phone: (919) 123-4567 Fax: (917) 123-8901 |

Twitter and Facebook</p>
</footer>

<script>
window.onscroll = function() {myFunction()};

var navbar = document.getElementById("navbar");
var sticky = navbar.offsetTop;

function myFunction() {
if (window.pageYOffset >= sticky) {
navbar.classList.add("sticky")
} else {
navbar.classList.remove("sticky");
}
}

</script>

</body>
</html>

CSS:

nav {
text-align:center;
}
ul {
display: inline-block;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
margin: auto;
  
}

li {
float: left;
}

li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}

li a:hover:not(.active) {
background-color: #111;
}

.active {
background-color: #791519;
}


.search {
display:none;
  
}
.search-toogle-button
{
padding:14px;
color:white;
display:block;
}
#search-togle {
display:none;
}
#search-togle:checked ~ .search {
display:block;
}nav {
text-align:center;
}
ul {
display: inline-block;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
margin: auto;
  
}

.center{
display: block;
margin-left: auto;
margin-right: auto;
width: 300px;
height: 300px;
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Here a new web page with name "index.html" is created, which contains following code.

Note :Images are used for demonstration purpose only, make changes as per requirement.

index.html :

<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<!--external stylesheet file -->

<link rel="stylesheet" href="styles.css">

</head>

<header>

<div class="content"></div>

<a href="home.html">

<img class="imgCenter" src="vmoto.gif" width="1380" height="200" >

</a>

</header>

<body>

<nav>

<ul>

<li><a class="active" href="index.html">Home</a></li>

<li><a href="mbike.html">Mountain Bike</a></li>

<li><a href="roadbike.html">Road Bike</a></li>

<li><a href="bmx.html">BMX</a></li>

<li><a href="about.html">About</a></li>

</ul>

</nav>

<figure>

<img src="bicycle-bike-daylight-100582 (1).jpg" class="center">

<a href="mbike.html"></a>

<figcaption>Thats right kids, we are now selling THE IronHorse bike. Ain't she a beaut!</figcaption>

</figure>



<section>

<h1>Bike text</h1>

<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et

eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae

nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

</section>

<center>

<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et

eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae

nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et

eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae

nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

<p class="ex1">Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et

eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae

nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

</center>


<footer>

<p>Contact Us! 123 Main St. Anywhere, NC 99999* | Phone: (919) 123-4567 Fax: (917) 123-8901 | Twitter and Facebook</p>

</footer>

<!--<script> is used for javascript -->

<script>

window.onscroll = function () { myFunction() };

var navbar = document.getElementById("navbar");

var sticky = navbar.offsetTop;

function myFunction() {

if (window.pageYOffset >= sticky) {

navbar.classList.add("sticky")

} else {

navbar.classList.remove("sticky");

}

}

</script>

</body>

</html>

**************************

styles.css :

/* style rule fot body */

body {

margin-left:100px;

margin-right: 100px;

font-family: Arial, Helvetica, sans-serif;

background: #8E8E8E;

/*use this propery as well */

/* text-align: center; */

}

/*style rule for all paragraphs */

p{

text-align: justify;

}

/*style rule for class=imgCenter */

.imgCenter{

margin-left: 60px;

}

/*style rule for figure */

figure{

text-align: center;

}

p.ex1 {

margin: 35px;

}


.content {

font-size: 17px;

text-align: center;

}

footer {

background-color: dimgrey;

padding: 10px;

text-align: center;

color: #DDD7D7;

}

nav {

text-align:center;

}

ul {

display: inline-block;

list-style-type: none;

margin: 0;

padding: 0;

overflow: hidden;

background-color: #333;

margin: auto;

}

li {

float: left;

}

li a {

display: block;

color: white;

text-align: center;

padding: 14px 16px;

text-decoration: none;

}

li a:hover:not(.active) {

background-color: #111;

}

.active {

background-color: #791519;

}


.search {

display:none;

}

.search-toogle-button

{

padding:14px;

color:white;

display:block;

}

#search-togle {

display:none;

}

#search-togle:checked ~ .search {

display:block;

}nav {

text-align:center;

}

ul {

display: inline-block;

list-style-type: none;

margin: 0;

padding: 0;

overflow: hidden;

background-color: #333;

margin: auto;

}

.center{

display: block;

margin-left: auto;

margin-right: auto;

width: 300px;

height: 300px;

}

======================================================

Output : Open web page index.html in the browser and will get the screen as shown below

Screen 1 :index.html

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
Hello, I am designing a website for my class. I am using HTML/CSS/Jscript. I need to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I cant seem to get the CSS at the bottom of this HTML to work. <!doctype...

    I cant seem to get the CSS at the bottom of this HTML to work. <!doctype html> <html lang="en"> <head> <!--Madison McCuiston--> <meta charset="utf-8"> <title>Amelie Boulangerie</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header>Amelie Boulangerie</header> <!-- change this to header tag --> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="pastries.html">Pastries</a></li> <li><a href="events.html">Events</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> <main> <H2>Experience the Difference</H2> <p><span class="bakery">Amelie Boulangerie</span> is the master of flavor combinations.The jewel-colored macarons come in the most tempting of flavors. Experience the difference...

  • Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore...

    Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem...

  • As part of this assignment we are using the base Gallery HTML and writing JavaScript code...

    As part of this assignment we are using the base Gallery HTML and writing JavaScript code that will: 1) preload the images provided to us, 2) Create rollover functionality for each of the thumbnails in your image gallery 3) Use appropriate images found in the images folder. 4) Write developer comments to describe the variables being declared and explain the functions and logical blocks of JavaScript code pertaining to the gallery. I know it has to be an external JS...

  • Problems: Develop a web page that allows a user to try out different text and background...

    Problems: Develop a web page that allows a user to try out different text and background color combinations by clicking buttons. Use Javascript to implement the functionalities. Below are two screen shots of the working application. Clicking the buttons at the bottom changes either the foreground color or the background color. The following descriptions are about the details. Specifically, you have to implement: An HTML file should include the following features (3 points) Some texts (Anything you like) Put the...

  • How do I get my HTML and CSS to look similar to this mockup? HTML: <!DOCTYPE...

    How do I get my HTML and CSS to look similar to this mockup? HTML: <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>nitro site</title>     <link href="css/main.css" rel="stylesheet"/> </head> <body>     <header class="header">     <section class="navlist">         <img class="logo" src="assets/logobeans.png"/>         <h2 class="headertitle">nitro</h2>     <nav>         <ul>             <li><a href="index.html" target="_parent">About</a></li>             <li><a href="/html/menu.html" target="_blank">Menu</a></li>             <li><a href="/html/menu.html">Shop Now</a></li>         </ul>     </nav>     </section>     <section class="headerContainer">         <h1 class="heading">Nitro Coffee</h1>         <p class="productDesc">Coffee is a brewed drink prepared from roasted coffee beans, the seeds of berries from certain Coffea species.</p>...

  • Hello, I was wondering if you could possibly think of ways to improve my home page then I would l...

    Hello, I was wondering if you could possibly think of ways to improve my home page then I would like you to do so. I know it could be better. Thank you. index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Untitled Document</title> <!-- Bootstrap --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <!-- Latest compiled JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script> <link href="style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <body> <header> <nav class="navbar...

  • given below are the project description and their Html and css files i need javascript according...

    given below are the project description and their Html and css files i need javascript according to the project and other files! WEB230 - JavaScript 1 Assignment 6b - Event Delegation Before starting, study the HTML and open it in a browser so that you understand the structure of the document. You will add functionality to perform several tasks in our shopping list app. Clicking the red "X" at the right of an item will delete that item. Clicking on...

  • Hello Ive been tryting to add the CDN of jquery to my html code and I...

    Hello Ive been tryting to add the CDN of jquery to my html code and I keep getting an error Need help with this : ​​ Navigate to www.code.jquery.com in your Chrome browser. On this page, you'll find different stable versions of jQuery. Select uncompressed for jQuery Core 3.3.1. Copy the <script> tag that is given to you. In store_hours.html, paste that tag directly above your body's closing tag. This is the jQuery CDN. After you paste this code into...

  • Create your own grid-based page using the sample HTML. Generate a Grid ( Experiment with Different...

    Create your own grid-based page using the sample HTML. Generate a Grid ( Experiment with Different Tools ) http://gridcalculator.dk/ Implement grid on the sample html file using pixels Convert to a percentage-based grid HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Out with the old...</title> <link rel="stylesheet" href="path-to-style.css"> <meta name="description" content="We are going to refine this document down to a good starting point for all html5 projects moving forward."> <meta name="author" content="ABC"> <link rel="shortcut icon" href="/favicon.ico" /> </head> <body> <div...

  • HTML/CSS/ Bootstrap grids to create image I am attemted to recreate a photo using bootstrap grids...

    HTML/CSS/ Bootstrap grids to create image I am attemted to recreate a photo using bootstrap grids and have come across a snag. I need this: To look more like this.... It does not really need to be perfect as far as scaling, at this point I just want the yellow box in the corner with borders like the pic. Also the original pic has white borders that we are ignoring. HTML <!doctype html> <html lang="en"> <head> <!-- Required meta tags...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT