Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: Simple code to center text?

  1. #1
    Join Date
    Jul 2008
    Location
    Wherever our 5th Wheel is
    Posts
    14
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Question Simple code to center text?

    our website's host went XHTML compliant, though I know some HTML - I'm slowing fixing those minor errors... but

    I can't figure out how to write a simple CSS code to center the text in our header, or how to make all my pages fonts be the same text and size!

    The host gives our shopping cart an "advanced css" space to add this stuff, but I'm not getting this at all.

    Do I write the html with the css (or XHTML) as <html> body etc... or?? I can't seem to figure out how to put it all together, sorry to bother everyone I'm sure this is a DUH


    I'm doing alot of reading up on this website about css, and maybe this is listed somewhere I haven't read yet?

    Thanks for any info, direction to point me to

    (btw website is www.wenchesatwork.com) hosted by godaddy

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    To center the text, you can use:
    Code:
    text-align:center;
    Which text do you mean? Is it "Wenches At Work Renaissance Clothing, Pirate and Wench Wear, Gypsy Glamour"?

    The basic syntax for html with CSS is either of this three:
    1. Inline on the head section:
    Code:
    <dtd>
    <html>
    <head><title></title>
    <style type="text/css">body{background:#f00;}</style>
    </head>
    <body></body></html>
    2. Inline in style attribute of an element:
    Code:
    <p style="border:1px solid #f00;">Contents</p>
    3. External:
    Code:
    Code:
    <dtd>
    <html>
    <head><title></title>
    <link rel="stylesheet" type="text/css" href="sourceOFcss.css">
    </head>
    <body></body></html>
    Hope it makes sense.
    Last edited by rangana; 07-03-2008 at 06:39 AM.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    HeadWench (07-05-2008)

  4. #3
    Join Date
    Jul 2007
    Location
    Azerbaijan, Baku
    Posts
    144
    Thanks
    11
    Thanked 27 Times in 25 Posts

    Default

    rangana, i think you mean this:

    Code:
    <link rel="stylesheet" type="text/css" href="sourceOFcss.css
    Code:
    <link rel="stylesheet" type="text/css" href="sourceOFcss.css/>

  5. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Ah, yes. Post edited.
    Also, self-closing of the link tag is optional on HTML 4.01 as per time being.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  6. #5
    Join Date
    Jul 2007
    Location
    Azerbaijan, Baku
    Posts
    144
    Thanks
    11
    Thanked 27 Times in 25 Posts

    Default

    Code:
    <link rel="stylesheet" type="text/css" href="sourceOFcss.css>
    LOL, now change that to this:

    [CODE]
    Code:
    <link rel="stylesheet" type="text/css" href="sourceOFcss.css">

  7. The Following User Says Thank You to allahverdi For This Useful Post:

    rangana (07-03-2008)

  8. #6
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Haha, done.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  9. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by rangana View Post
    Ah, yes. Post edited.
    Also, self-closing of the link tag is optional on HTML 4.01 as per time being.
    But not in XHTML. In XHTML, it is required.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. The Following User Says Thank You to jscheuer1 For This Useful Post:

    HeadWench (07-05-2008)

  11. #8
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    But not in XHTML. In XHTML, it is required.
    Indeed.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  12. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by rangana View Post
    Indeed.
    Well, it actually is not allowed in HTML 4.01 though. So this 'optional' business you were talking about is just at the behest of browser's error correcting.

    Now, I know that HeadWench said that:

    our website's host went XHTML compliant
    So you should know that's what we are talking about, if you were reading the thread.

    This makes me scratch my head though, because XHTML isn't really implemented yet in IE, so pages with that DOCTYPE can get pretty screwy in that browser, except that generally IE will parse it as error corrected HTML 4.01 strict (or maybe loose, not sure).

    In fact, if truly served as xml/XHTML (via the proper prologue), IE will not display the page at all.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  13. The Following 2 Users Say Thank You to jscheuer1 For This Useful Post:

    HeadWench (07-05-2008),rangana (07-03-2008)

  14. #10
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    Well, it actually is not allowed in HTML 4.01 though. So this 'optional' business you were talking about is just at the behest of browser's error correcting.
    I totally disagree.

    Please see link (validated):
    http://h1.ripway.com/rangana/test.htm

    For further reading:
    http://www.w3schools.com/XHTML/xhtml_html.asp
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •