Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 4th, 2010, 9:28 AM   #1
Rem1978
Programmer
 
Join Date: May 2009
Posts: 39
Rep Power: 0 Rem1978 is on a distinguished road
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>
Rem1978 is offline   Reply With Quote
Old Feb 4th, 2010, 10:55 AM   #2
alienkinetics
Programmer
 
alienkinetics's Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1 alienkinetics is on a distinguished road
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>
alienkinetics is offline   Reply With Quote
Old Feb 4th, 2010, 11:53 AM   #3
hivelocitydd
Programmer
 
Join Date: Dec 2008
Location: Localhost
Posts: 38
Rep Power: 0 hivelocitydd is on a distinguished road
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
hivelocitydd is offline   Reply With Quote
Old Feb 4th, 2010, 4:49 PM   #4
Rem1978
Programmer
 
Join Date: May 2009
Posts: 39
Rep Power: 0 Rem1978 is on a distinguished road
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.
Rem1978 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:46 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC