Click here to Skip to main content
15,067,539 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am an 8th grade student doing a project for school, so I am relatively new to coding. There is a bit of space to the left of my footer aligned with the text of the website. Can someone please revise my code and tell me whats wrong?

[CSS]
CSS
@charset "UTF-8";
body {
  margin: 0;
}
.header {
  width: 100%;
  height: 190px;
  background-color: #666666
}
body div a img {
  width: 1366px;
  height :160px;
}
.nav {
  height: 40px;
  background: #333;
}

.nav ul {
  margin: 0;
  padding: 150;
}
.nav ul li {
  list-style: none;
}
.nav ul li a {
  text-decoration: none;
  float: left;
  display: block;
  padding-left: 300px;
  padding-top: 10px;
  color: white;
}
.nav ul li a:hover {
  color: black;
}
.header1 {
  margin-left: 10px;
  margin-top: 10px;

}
.footer {
  width: 100px;
  height: 100px;
  background-color: black;
  float: left;
}


[HTML]
HTML
<!DOCTYPE html>


     <title>Advocates For a Cause
     

     <div class="header">
         
       <div class="nav">
         <ul>
           <li><a href="home.html">Home</a></li>           <li><a href="support.html">Support</a></li>           <li><a href="contact.html">Contact</a></li>         </ul>
   </div>
 </div>


  <div class="header1">
  <h1>What is depression?</h1>
  <div class="body1">
  <p>Before we start, we need to explain what depression is. Depression is a mental issue that can make someone feel sad all the time and make them feel worthless. We are going to answer 6 important questions about depression today.
  </p><ul>
    <li>Why is depression such a big issue?</li>    <li>Why do people get depression?</li>    <li>Why should I help people with depression?</li>    <li>How can I cope with my depression?</li>    <li>How can I help my friends and family members who have depression?</li>    <li>How can I avoud Depression?</li>  </ul>
  <p></p>
  <div class="header2">
    <h1>Why is depression such a big issue?</h1>
    <div class="body2">
  <p>Before we start, we need to explain what depression is. Depression is a mental issue that can make someone feel sad all the time and make them feel worthless. We are going to answer 6 important questions about depression today.
  </p><ul>
    <li>Why is depression such a big issue?</li>    <li>Why do people get depression?</li>    <li>Why should I help people with depression?</li>    <li>How can I cope with my depression?</li>    <li>How can I help my friends and family members who have depression?</li>    <li>How can I avoud Depression?</li>  </ul>
  <p></p>
  <div class="header2">
    <h1>Why is depression such a big issue?</h1>
    <div class="body2">
    <p>Many people dont see depression as that big of an issue because theres things like cancer, and heart diseases and all these physical diseases, which are a bigger problem right? Wrong! Depression can give you suicidal thoughts, and about one million people commit suicide a year. Depression can make things you used to find fun boring, it can make you really sad and think your worthless or helpless. Just because it is not a physical health problem does not make it any less important.

 </p><div class="header3">
    <h1>Why do people get depression?</h1>
<div class="text3">
  <p>Depression can be caused by many different factors. Depression can run in your family or it could occur because of your personality. Depression can also occur from drug and alcohol use or abuse. One of the biggest causes of depression is PTSD(Post Traumatic Stress Disorder.) PTSD is a mental illness that can occur when you go through something traumatic in your life.</p>

  <div class="header4">
    <h1>Why should I help people with depression?</h1>
    <div class="body4">
    <p>You should help people with depression because it is the right thing to do. Depression can make someone feel helpless with there life and it makes them always be sad. Helping someone you know that has depression could prevent them from commiting suicide, which is a great thing to do.</p>
    <div class="header5">
    <h1>How can I cope with depression?</h1>
    <div class="body5">
      <p>Coping with depression is not the easiest thing to do sometimes, but it is possible. A good way to cope with depression is getting rid of all the negative things in your life. Talking to a therapist and getting your feelings out to someone also helps greatly. Drinking less alcohol also can lessen your depression.</p>
<div class="header6">
  <h1>How can I help a friend or family member with depression?</h1>
  <div class="body6">
    <p>There are many ways to help a loved one that has depression. Listening to them is a great way to support them, letting them now that someone cares about them can make them feel more important. You can also offer them activities that can distract them from depressing thoughts. Doing a little bit of research can help you understand them better too.</p>
    <div class="header7">
      <h1>   How can I avoid depression</h1>
      <div class="body7">
        <p>   To avoid depression you need to avoid stress. Avoiding stress can help you avoid depression because stress is a big factor to causing depression. Eating and sleeping is good to, a good diet and a healthy amount of sleep can make you feel good throughout the day. Avoid negative things and people, avoiding anything or anyone negative could easily help you avoid depression.</p>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>


What I have tried:

setting the margin of text to 0, fixed the footer but also set the text to the 0
Posted
Updated 3-May-18 15:12pm
v5
Comments
Bryian Tan 29-Apr-18 1:01am
   
where is your html markup? is tough for us to imagine what your site look like without all the information.
Member 13803252 29-Apr-18 7:20am
   
I have the HTML
Bryian Tan 29-Apr-18 14:04pm
   
Can you post it again, the header and footer didn't show up in the markup. Make sure to wrap the html in the <pre></pre> tags
Kornfeld Eliyahu Peter 30-Apr-18 15:59pm
   
There is no footer at all in your HTML!?!

Try with below, it should resolve your issue.

<!DOCTYPE html>


<title>Advocates For a Caus</title>



<style>
    @charset "UTF-8";
    body {
        margin: 0;
    }
    
    .header {
        width: 100%;
        background-color: #666666
    }
    
    body div a img {
        width: 1366px;
        height: 160px;
    }
    
    .nav {
        height: 40px;
        background: #333;
    }
    
    .nav ul {
        margin: 0;
        padding: 150;
    }
    
    .nav ul li {
        list-style: none;
    }
    
    .nav ul li a {
        text-decoration: none;
        float: left;
        display: block;
        padding-left: 300px;
        padding-top: 10px;
        color: white;
    }
    
    .nav ul li a:hover {
        color: black;
    }
    
    .header1 {
        margin-left: 10px;
        margin-top: 10px;
    }
    
    .footer {
        width: 100px;
        height: 100px;
        background-color: black;
        float: left;
    }
</style>

<body>
    <div class="header">

        <div class="nav">
            <ul>
                <li><a href="home.html">Home</a></li>
                <li><a href="support.html">Support</a></li>
                <li><a href="contact.html">Contact</a></li>
            </ul>
        </div>

    </div>

    <div class="header1">
        <h1>What is depression?</h1>
        <div class="body1">
            <p>Before we start, we need to explain what depression is. Depression is a mental issue that can make someone feel sad all the time and make them feel worthless. We are going to answer 6 important questions about depression today.
            </p>
            <ul>
                <li>Why is depression such a big issue?</li>
                <li>Why do people get depression?</li>
                <li>Why should I help people with depression?</li>
                <li>How can I cope with my depression?</li>
                <li>How can I help my friends and family members who have depression?</li>
                <li>How can I avoud Depression?</li>
            </ul>
            <p></p>
            <div class="header2">
                <h1>Why is depression such a big issue?</h1>
                <div class="body2">
                    <p>Before we start, we need to explain what depression is. Depression is a mental issue that can make someone feel sad all the time and make them feel worthless. We are going to answer 6 important questions about depression today.
                    </p>
                    <ul>
                        <li>Why is depression such a big issue?</li>
                        <li>Why do people get depression?</li>
                        <li>Why should I help people with depression?</li>
                        <li>How can I cope with my depression?</li>
                        <li>How can I help my friends and family members who have depression?</li>
                        <li>How can I avoud Depression?</li>
                    </ul>
                    <p></p>
                    <div class="header2">
                        <h1>Why is depression such a big issue?</h1>
                        <div class="body2">
                            <p>Many people dont see depression as that big of an issue because theres things like cancer, and heart diseases and all these physical diseases, which are a bigger problem right? Wrong! Depression can give you suicidal thoughts,
                                and about one million people commit suicide a year. Depression can make things you used to find fun boring, it can make you really sad and think your worthless or helpless. Just because it is not a physical health problem
                                does not make it any less important.

                            </p>
                            <div class="header3">
                                <h1>Why do people get depression?</h1>
                                <div class="text3">
                                    <p>Depression can be caused by many different factors. Depression can run in your family or it could occur because of your personality. Depression can also occur from drug and alcohol use or abuse. One of the biggest causes
                                        of depression is PTSD(Post Traumatic Stress Disorder.) PTSD is a mental illness that can occur when you go through something traumatic in your life.</p>

                                    <div class="header4">
                                        <h1>Why should I help people with depression?</h1>
                                        <div class="body4">
                                            <p>You should help people with depression because it is the right thing to do. Depression can make someone feel helpless with there life and it makes them always be sad. Helping someone you know that has depression
                                                could prevent them from commiting suicide, which is a great thing to do.</p>
                                            <div class="header5">
                                                <h1>How can I cope with depression?</h1>
                                                <div class="body5">
                                                    <p>Coping with depression is not the easiest thing to do sometimes, but it is possible. A good way to cope with depression is getting rid of all the negative things in your life. Talking to a therapist
                                                        and getting your feelings out to someone also helps greatly. Drinking less alcohol also can lessen your depression.</p>
                                                    <div class="header6">
                                                        <h1>How can I help a friend or family member with depression?</h1>
                                                        <div class="body6">
                                                            <p>There are many ways to help a loved one that has depression. Listening to them is a great way to support them, letting them now that someone cares about them can make them feel more important.
                                                                You can also offer them activities that can distract them from depressing thoughts. Doing a little bit of research can help you understand them better too.</p>
                                                            <div class="header7">
                                                                <h1> How can I avoid depression</h1>
                                                                <div class="body7">
                                                                    <p> To avoid depression you need to avoid stress. Avoiding stress can help you avoid depression because stress is a big factor to causing depression. Eating and sleeping is good to, a good
                                                                        diet and a healthy amount of sleep can make you feel good throughout the day. Avoid negative things and people, avoiding anything or anyone negative could easily help you avoid depression.</p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
   
I do not see a tag for your footer on the HTML..?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900