Results 1 to 2 of 2

Thread: Can you use a div as a background?

  1. #1
    Join Date
    Apr 2008
    Posts
    84
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Can you use a div as a background?

    Hi, all.

    I was just thinking about a crazy idea, wondering if it's possible.

    Can a div be used to have all the characteristics of the background?

    What I'd like to try is to have a div filled with a paragraph or 2 of big, lightly colored, justified text, that fills the entire screen, and won't affect the scrollbars, and will wrap to fit the users viewport, revealing more of the text if the user has a big screen.

    Possible?

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Sure, it's possible. It's quite simple really. All you have to do is add height:100% and width:100% to it's style attributes.

    But, I doubt it's necessary. You can style the <html> and <body> tags in much the same way as you would a div. So, I'd suggest adding the styling you would to a <div> and add it to the <body> tag. It'll reduce your markup.

    The trick would be to add overflow:hidden to your <html> and<body> tag's styles.

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
  •