Jump to content

Basic header colour and text


Html

Recommended Posts

<head>
<style>
body 
h1 {
  color: white;
}
div {
  border: 2px white;
  background-color: red;
  padding-top: 50px;
  padding-right: 30px;
  padding-bottom: 50px;
  padding-left: 80px;
}
</style>
</head>

I have used <h1>header text</h1> in the body section.

The padding works, but no text on the padding. Aiming for that https://www.w3schools.com/code/tryit.asp?filename=G1W9NUG2JAYH

Thank you.

Edited by Html
Added link demo
Link to comment
Share on other sites

div {
  border: 2px white;
  background-color: red;
  padding-top: 50px;
  padding-right: 30px;
  padding-bottom: 50px;
  padding-left: 80px;
}

 

That is the header in red, that loads, but the text won't load on top in white.

Link to comment
Share on other sites

Oh right! Where using secret code to hide what we really want and mean, got yeah! Ok! We add color: white; to the FOOTER (nudge nudge wink wink), which makes the text within FOOTER  (nudge nudge wink wink) white against the HEADER  (nudge nudge wink wink) background.

Link to comment
Share on other sites

<style>
h1 {
    color: white;
    }
div {
border: 2px white;
background-color: red;
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
</style>
 
<center>
<div><h1>header</h1></div>
</center>
 
Now this works.
Link to comment
Share on other sites

I wouldn't know. First time I have used CSS since I first had a book on it back in 2006/2007, and then got rid off in 2008 when I gave up on trying to learn some website design.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...