Title: Nesting elements that shouldn&#039;t be nesting?
Last modified: August 20, 2016

---

# Nesting elements that shouldn't be nesting?

 *  Resolved [Jess](https://wordpress.org/support/users/urracacreative/)
 * (@urracacreative)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/nesting-elements-that-shouldnt-be-nesting/)
 * I’m trying to style the date and title on my main post index, but the <p> element
   for my date is inside the <h2> element for my title. As far as I can tell, this
   should not be the case. I’ve got the code written like this:
 *     ```
       <p class="date"><?php the_time('d'); ?><span><?php the_time('M'); ?></span></p>
       <h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
       ```
   
 * If you check out a the page on my site that I’m working on ([http://www.urracacreative.com/blog/](http://www.urracacreative.com/blog/)),
   you can see that the bottom border on the h2 extends under the date, but I don’t
   want it to extend any further to the left than the edge of the title. Does that
   make sense?
 * Can anybody tell me what I’m doing wrong? I don’t understand why my <p> is sitting
   inside my <h2> since both elements are closed and they should not be nested.
 * Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Christine Rondeau](https://wordpress.org/support/users/crondeau/)
 * (@crondeau)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/nesting-elements-that-shouldnt-be-nesting/#post-3140581)
 * Try adding a margin-left:60px; to your h2 title.
    That should move the border.
 *  Thread Starter [Jess](https://wordpress.org/support/users/urracacreative/)
 * (@urracacreative)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/nesting-elements-that-shouldnt-be-nesting/#post-3140593)
 * Worked like a charm! I knew there had to be a simple solution. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Nesting elements that shouldn't be nesting?’ is closed to new replies.

## Tags

 * [elements](https://wordpress.org/support/topic-tag/elements/)
 * [nested](https://wordpress.org/support/topic-tag/nested/)
 * [nesting](https://wordpress.org/support/topic-tag/nesting/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jess](https://wordpress.org/support/users/urracacreative/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/nesting-elements-that-shouldnt-be-nesting/#post-3140593)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
