• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Simple exercise, yet I am stuck

I am very new to HTML and trying a simple exercise of making "Hello World!" have a green background on top of the already blue one. I am at a complete loss and not sure what my error is. I have a suspicion that the div class is not in the right spot but whenever I move it my code crashes.
PgnU76Q.png


HTML:
<!DOCTYPE html>
<html>
<head>
<style>
  body {background: lightblue;}
  .container {text-align: in-the-middle;}
  #center {width: 90%; color-of-background: olive; border-radius: 20px;}
</style>
</head>
<body>
  <div class="container">
    <div class="center">
      <h1 style="color: white">Hello World!</p>
    </div>
</body>
</html>
 

menator01

King Coder
I re-wrote part of your code

HTML:
<!DOCTYPE html>
<html>
    <head>
        <title>My Page</title>
        <style>
            body {
                background-color: rgb(50,20,20);
            }
            .container {
                width: 350px;
                height: 400px;;
                border: solid 1px rgb(155,80,10);
                border-radius: 50%;
                border-width: 5px;
                position: relative;
                margin: 50px auto;
                box-shadow: inset 0px 0px 20px 5px rgba(0,0,0,0.7);
                background-image: url('ratt.svg'), linear-gradient(rgba(100,10,10,0.5), rgba(100,55,30,0.7));
                background-repeat: no-repeat;
                background-color: rgba(50,0,0,0.7);
                background-position: center;
                padding: 20px;
                
            }
        </style>
    </head>
    <body>
        <div class="container"></div>
    </body>
</html>
 

Attachments

  • Screenshot from 2022-10-20 12-56-18.png
    Screenshot from 2022-10-20 12-56-18.png
    125 KB · Views: 5
Last edited:
I re-wrote part of your code

HTML:
<!DOCTYPE html>
<html>
    <head>
        <title>My Page</title>
        <style>
            body {
                background-color: rgb(50,20,20);
            }
            .container {
                width: 350px;
                height: 400px;;
                border: solid 1px rgb(155,80,10);
                border-radius: 50%;
                border-width: 5px;
                position: relative;
                margin: 50px auto;
                box-shadow: inset 0px 0px 20px 5px rgba(0,0,0,0.7);
                background-image: url('ratt.svg'), linear-gradient(rgba(100,10,10,0.5), rgba(100,55,30,0.7));
                background-repeat: no-repeat;
                background-color: rgba(50,0,0,0.7);
                background-position: center;
                padding: 20px;
               
            }
        </style>
    </head>
    <body>
        <div class="container"></div>
    </body>
</html>
Oh wow, thank you so much! Also, good catch I really appreciate it.
 
Top