![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2009
Posts: 39
Rep Power: 0
![]() |
help with positioning element
I'm new to html. I'm trying to use the cascading style sheet to do some positioning in my document. I would like to have the h1 centered on the page and have text body with a left margin of 150px with background color black of the page black. I'm not quite sure how to move just the text in the <p> without moving the title? If I just specify the <p> I can move the text but the background color only affects what's in the <p> tag and not the entire body of the document. This is probably is easy but I've gotten confused. What would be the best way to just move the text 150px and not affect the h1 tag and keep the entire body black? Thank you in advance.
html>
<HEAD>
<style type = "text/css">
h1 {color: purple; text-align: center;}
body.p {margin-left: 150px; background-color: black; color: yellow}
</style>
<title> Learning HTML </title>
</HEAD>
<body>
<h1> h1 Title </h1>
<p> text body
</body>
</html> |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1
![]() |
Re: help with positioning element
Is this what you want?
<html>
<HEAD>
<style type = "text/css">
h1 {color: purple; text-align: center;}
body {background-color: black;}
p {margin-left: 150px;color: yellow}
</style>
<title> Learning HTML </title>
</HEAD>
<body>
<h1> h1 Title </h1>
<p> text body</P>
</body>
</html> |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Dec 2008
Location: Localhost
Posts: 38
Rep Power: 0
![]() |
Re: help with positioning element
<html>
<HEAD>
<style type = "text/css">
body {background-color: black;}
body.h1 {color: purple; text-align: center;}
body.p {margin-left: 150px;color: yellow}
</style>
<title> Learning HTML </title>
</HEAD>
<body>
<h1> h1 Title </h1>
<p> text body</P>
</body>
</html>You can try this too ...
__________________
Dedicated Servers - sales@hivelocity.net - 1-888-869-HOST(4678) WINDOWS DEDICATED SERVERS - Award Winning Hosting Managed Dedicated Servers. Reseller Discounts. 24/7 Impressive Tech Support. Last edited by hivelocitydd; Feb 4th, 2010 at 11:53 AM. Reason: missed the bb code |
|
|
|
|
|
#4 |
|
Programmer
Join Date: May 2009
Posts: 39
Rep Power: 0
![]() |
Re: help with positioning element
Thank you both! Yes, I think that will be what I need. I know it was an easy one but I got confused.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| removing an element from an array | cwl157 | C | 17 | Feb 3rd, 2010 8:31 PM |
| Setting up internal element height to 100% | hostgator | HTML / XHTML / CSS | 1 | Dec 7th, 2009 1:24 AM |
| Positioning an Element in Screen Space | Dameon | HTML / XHTML / CSS | 4 | Dec 3rd, 2005 7:29 PM |