Jump to content


Photo
- - - - -

Add div to homepage


  • Please log in to reply
4 replies to this topic

#1 akennedy

akennedy

    Newbie

  • Members
  • 3 posts

Posted 17 October 2011 - 02:38 PM

My home page content only needs to contain an image. However, when I tried inserting that image into the page it gets resized and there's too much margin around it (

Please Login or Register to see this Hidden Content

). The image has to be snug against all of the elements surrounding it (navigation menu, sidebar, footer), so I want to see if it's possible to insert a div that appears only on the home page and contains the large image I need. I figured with the div, I can create the "gapless" layout. Thanks, Andrew

#2 Kate

Kate

    Advocate

  • Members
  • 3039 posts

Posted 17 October 2011 - 03:20 PM

Hi Andrew, You could just assign the img an ID, or even reference it using the unique class ("home") given to the home page, and drilling down in the CSS. From there you could use negative margins to pull it up and over, or even just decrease the padding of the parent container. If you need help with any of these approaches, let us know.

#3 akennedy

akennedy

    Newbie

  • Members
  • 3 posts

Posted 17 October 2011 - 09:51 PM

Kate, Thanks a lot. I've modified themes before, but am having trouble with how exactly Base works. Since I want this to only affect the home page, should I do a conditional tag somewhere using "is_home()" and then insert the Div or do I create a php file for Base... something like "template.[index].php" and place the code in there? Sorry to be annoying.

#4 kastelic

kastelic

    Advocate

  • Members

  • 3081 posts
  • Country: Country Flag

Posted 17 October 2011 - 10:43 PM

If you look at the body tag of any page you will see classes unique to that page. That way you can only affect the homepage right in the CSS, without any php conditionals. Although in this case its not necessary:

Please Login or Register to see this Hidden Content



#5 akennedy

akennedy

    Newbie

  • Members
  • 3 posts

Posted 18 October 2011 - 04:08 PM

Thank you! That worked.