[SOLVED] Content

This is a discussion on "[SOLVED] Content" within the Web Page Design section. This forum, and the thread "[SOLVED] Content are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 26th, 2007, 04:16
Reputable Member
Join Date: Oct 2007
Location: At my house
Age: 22
Posts: 193
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Content

How do I center all my content using css as appose to using a table?
Reply With Quote

  #2 (permalink)  
Old Oct 26th, 2007, 05:27
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Content

Well, your sample code will be helpful!

Do you want to center the element itself (your div) or the element inside the div (eg. your <h1> or <p>)?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #3 (permalink)  
Old Oct 26th, 2007, 09:24
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,790
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: Content

try something like:

Code: Select all
#content {
width: 800px;
height: 1000px;
margin: 0 auto;
}

And your html would be:
HTML: Select all
<div id="content">
content
</div>
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #4 (permalink)  
Old Oct 26th, 2007, 09:37
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Content

That would be positioning the div horizontally center.

If you want to center the elements inside the div, you would use:

Code: Select all
 p {
text-align: center;
}
to center up all your paragraph inside the div that Alex just created.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #5 (permalink)  
Old Oct 26th, 2007, 09:44
Up'n'Coming Member
Join Date: Jun 2007
Location: Germany
Age: 23
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

If you want to center your content horizontal and vertically, you can use a wrapper div.
Using fixed pixel values, you can do it this way:
HTML: Select all
...
<body>
<div style='position:absolute; left:50%; top:50%;'>

<div style='position:absolute; left:-200px; top:-100px; width:400px; height:200px; border:1px solid black;'>
This box with a black border is totally centered! How nice.
</div>

</div>
</body>
...
There are alternative versions for % values or non-fixed areas.
Reply With Quote
  #6 (permalink)  
Old Oct 26th, 2007, 09:45
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,790
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: Content

Monie it will not center all elements, just text.
And personally center aligned text is awful looking, I wouldn't use it!
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #7 (permalink)  
Old Oct 26th, 2007, 09:48
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: Content

yeap.. It depends on what thewebkid means "content" in his question.
Thanks for clearing that up.

If he got image inside the div, he would just have to put this in his css code:

Code: Select all
#content {
width: 800px;
height: 1000px;
margin: 0 auto;
 text-align: center;
}
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #8 (permalink)  
Old Oct 26th, 2007, 12:29
Reputable Member
Join Date: Oct 2007
Location: At my house
Age: 22
Posts: 193
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

OK sorry for the lack of information I have given you. I will draw you out what I want the basic layout of my website to look like. It's like that "holy grail thing" I just learned a little of CSS in my class and not enough to know how to layout a page. brb with the image
Reply With Quote
  #9 (permalink)  
Old Oct 26th, 2007, 12:43
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

Quote:
Originally Posted by thewebkid View Post
It's like that "holy grail thing" I just learned a little of CSS in my class and not enough to know how to layout a page.
The "holy grail" is, I believe, a misleading name.

Most websites don't need three columns. Use two columns unless you have a very good reason for three.

Since you're new to CSS, don't attempt complicated layouts. Most of them are pointless anyway, and you'll only confuse yourself.
Reply With Quote
  #10 (permalink)  
Old Oct 26th, 2007, 12:47
Reputable Member
Join Date: Oct 2007
Location: At my house
Age: 22
Posts: 193
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

Then What should I do? I don't want a beginner looking website.(that seems pretty prideful) I want to make i appealing and make it look like I really work hard on it.


......Ok now I am going to be more specific. This here shows the type of layout I want. I can do this with tables, but we all know that's a big RED LIGHT when it comes to web design. I want to be able to apply this to all my web pages(obviously) and have just a plain background color which I will chose later. Thank you for your help.
Attached Images
File Type: jpg layout.jpg (37.2 KB, 8 views)
Reply With Quote
  #11 (permalink)  
Old Oct 26th, 2007, 12:49
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

See the August editions of the Newsletter ... I have touched this in the FAQ

How do I center my site horizontally?
Reply With Quote
  #12 (permalink)  
Old Oct 26th, 2007, 12:53
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,790
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: Content

put all of the divs inside a master div and use my first code.
e.g. The CSS:
HTML: Select all
#wrapper {
width: 800px;
height: 1000px;
margin: 0 auto;
}

The html:

HTML: Select all
<div id="wrapper">
<div id="logo"><img> etc. etc.</div>
more divs here...
</div>
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #13 (permalink)  
Old Oct 26th, 2007, 12:58
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,661
Thanks: 0
Thanked 9 Times in 9 Posts
Re: Content

From your example to get the div to strech down the page on everyone's screens you will need to kinda hack it.

I found Ryan Fait's (was a webforumz member but isnt as active now!) sticky footer a good example. It can be found here: http://ryanfait.com/sticky-footer/.

Also to center the div you use the margin:0 auto; code
Reply With Quote
  #14 (permalink)  
Old Oct 26th, 2007, 13:11
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

Guys ... stop repeating yourselves!
Reply With Quote
  #15 (permalink)  
Old Oct 26th, 2007, 13:17
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,790
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: Content

Ha yeah, seems like everyone has to clarify what everyone else says..
And I now realise by saying this I'm being a hypocrite..
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #16 (permalink)  
Old Oct 26th, 2007, 13:27
Reputable Member
Join Date: Oct 2007
Location: At my house
Age: 22
Posts: 193
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

Have I stirred up trouble?
Reply With Quote
  #17 (permalink)  
Old Oct 26th, 2007, 13:32
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

Not really but next time it would help if you'd be more specific in your opening post!

But then ... the members here are trigger happy and can't wait to help out without even knowing what the OP needs help with
Reply With Quote
  #18 (permalink)  
Old Oct 26th, 2007, 13:37
Reputable Member
Join Date: Oct 2007
Location: At my house
Age: 22
Posts: 193
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

lol sorry. I was in a rush and wanted to get the subject going before calling it a day.
Reply With Quote
  #19 (permalink)  
Old Oct 26th, 2007, 13:55
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,790
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: Content

Anyway, did any of the suggestions work?
Or do you need more help?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #20 (permalink)  
Old Oct 26th, 2007, 14:05
Reputable Member
Join Date: Oct 2007
Location: At my house
Age: 22
Posts: 193
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Content

I used your suggestion, but the page looks off center, it's more to the left
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expandable Content Script (Swtich Content) Matc JavaScript Forum 0 Apr 8th, 2008 10:53
Content Placement + Content Dividing josephman1988 Website Planning 2 Jan 22nd, 2008 05:02
[SOLVED] How do I Make Content available for download chrissmith Starting Out 4 Nov 11th, 2007 10:13
[SOLVED] the Main Content div of my template breaks when I type a long text kee2ka4 Web Page Design 2 Nov 9th, 2007 11:26
Layering content on content in CSS? wickedmoon Web Page Design 1 Sep 10th, 2007 15:23


All times are GMT. The time now is 04:58.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43