Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • 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.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • 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>
 
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.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom