Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm a beginner in learning HTML & CSS language and I try to build a page, but i had a problem with Footer it comes in the middle of the page, and the background image looks weird too big. If anyone can help to correct this code I will be thankful.

What I have tried:

HTML:
<body>
       
        <div id="menu">
            <a href="#" class="btn">الصفحة الرئيسية</a>
            <a href="#" class="btn">من نحن</a>
            <a href="#"class="btn">تواصل معنا</a>
            <a href="#" class="btn">تفاصيل الدورة </a>
        </div>
        <div class="mainbody">
        <div class="thecenter">
            <p id="maintext"> دورة لتعلم css</p>
            <div>      
            <button > انضمام</button>
            </div>
        </div>
    </div>
          </body>
          <div class="footer">
            <h4>الحقوق محفوظة2021</h4>
        </div>
    
</html>



CSS:
<html>
    <head>

        <title> ترميز</title>
        <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap" rel="stylesheet">
        <style>
            body{
                background-image: url('cssphoto.jpg');
                background-size: 100%;
                position:relative ;
                background-attachment: scroll;
                direction:rtl;
             
            }
            #menu{
                margin-right: 30px;
                margin-top: 10px;
                background-color: rgb(164, 189, 235);
                padding: 20px;
                border-radius: 10px;
                margin-left: 0;
                margin-right: 0;
                font-family:'Cairo', sans-serif;

            }
           
            #menu > .btn{
                color: black;
                text-decoration: none;
                font-size: bold;
               padding: 5px;
               border-radius: 20px;
               transition: background 0.3s;


            }
            #menu> .btn:hover{
                background-color: rgb(84, 138, 139);
            }
            .thecenter{
                margin-top: 50px;
                direction: rtl;
                justify-content: center;
                margin-top: 50px;
                text-align:center;
                font-family:'Cairo', sans-serif;

            }

            #maintext{
                color: wheat;
                font-size: 50px;
            }
           button{
                font-size: 20px;
                background-color: rgb(240, 169, 169);
                border:none;
                border-radius: 50px;
                width: 90px;
                height: 30px;
                color: white;
                margin-bottom: 30px;

            }
         .footer{
                background-color:rgb(191, 208, 240); 
                text-align: center;
                color: black;
                padding: 10px  0;
                width: 100%;
                position:center;
                justify-content: center;


            }

        </style>
    </head>
Posted
Updated 17-Dec-21 18:51pm
Comments
Luc Pattyn 14-Dec-21 16:34pm    
A footer belongs inside the body; and there is a footer tag in modern HTML.
See tag_footer

1 solution

In your html body tag ,kindly change this and check:


</div>
   </body>
   <div id ="footer">//changes made
     <h4>الحقوق محفوظة2021</h4>
 </div>


And in CSS made the changes and check:

#footer {

                background-color:rgb(191, 208, 240); 
                text-align: center;
                color: black;
                padding: 10px  0;
                width: 100%;
                position:center;
                justify-content: center;

 }
 
Share this answer
 

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