Background color source code

Solved
Mehdi-Amg Posted messages 95 Registration date   Status Member Last intervention   -  
 Techno01 -
Hello,
I'm looking for the source code to set a background color for text but not for the entire page, just at the top, as if I were creating a banner with the website title. I hope you understand what I mean.
Thank you in advance!

Configuration: Mac OS X / Safari 534.51.22

1 answer

  1. Techno01
     
    not quite

    try this
    <html>
    <head>
    <meta charset="utf-8">
    <title>Page</title>
    <style type="text/css">
    .banner
    {
    width:100%;
    height:160px;
    background-color:green;//or your favorite color
    }
    </style>
    </head>

    <body>
    <div class="banner">
    </div>
    </body>
    </html>
    11
    1. Mehdi-Amg Posted messages 95 Registration date   Status Member Last intervention   11
       
      Honestly, I couldn't have hoped for better. Thank you very much.
      3
    2. Techno01
       
      You're welcome, but how did you manage to display [resolved] in this forum? I'm new to this forum.
      0
    3. Mehdi-Amg Posted messages 95 Registration date   Status Member Last intervention   11
       
      Just above the post title. And one last question... How do I put text in this colored area?
      1
    4. Techno01
       
      So you need to ask this question under a different title so that others know it too, okay?
      2
    5. Techno01
       
      you are clingy lol
      I'm saying this just so that others can benefit..
      you should know that this is called CSS programming, almost all websites contain CSS code

      <html>
      <head>
      <meta charset="utf-8">
      <title>Page</title>
      <style type="text/css">
      .banner
      {
      width:100%;
      height:160px;
      background-color:green;
      text-align:left;// you can use right or center instead of left to position the text
      }
      .text
      {
      color : #f00;
      /*you can invoke colors by 3 methods
      1 : The name of the color like purple
      2 : Hex notation #FF0000 or #f00
      3 : Or by rgb|red green blue| for example rgb(255,0,0)
      }
      </style>
      </head>

      <body>
      <div class="banner">
      <p class="text">Your text</>
      </div>
      </body>
      </html>
      2