Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to configure my content-page.php but i'm struggling with a few 'mistakes'.

<article id="post-<?php the_ID(); ?>">
<div class="page_content">
<h1><?php the_title(); ?></h1>
**<p class="page_tekst">
<?php the_content(); ?>
</p>**
</div>
</article>

This is my css content

.page_content
{
    width:820px;
    height:auto;
    margin-bottom:50px;
}

.page_tekst
{
    text-align:justify;
    float:left;
}

This is the result in my browser

<article id="post-81">
<div class="page_content">
<h1>test</h1>
<p class="page_tekst">
<p>This is a test based on the current css code</p>
</p>
</article>

My css on the .page_tekst won't work. I also understand why but is there a solution for it? Can you make a div or p tag, give it a call and put the content in this tag without making another P tag with the content?

share|improve this question
2  
P elements are not block elements, you should not be nesting them as the browser will correct the issue by separating them out into multiple elements. use a div or some other block element rather than an inline element such as a p tag –  Tom J Nowell Jan 25 '13 at 22:55

1 Answer 1

WordPress inserts p tags in the_content(), otherwise it would be rather difficult for your content to contain more than one paragraph. If you want to target the p WordPress inserts, just change your css to:

.page_content p
{
    text-align:justify;
    float:left;
}

and remove your wrapping <p> tag.

share|improve this answer
    
Thanks for your answer. What i'm trying to reach is to add some text together with a featured image. The image must 'wrap' around the text. But with your answer in my head, I think this is fully possible. Isn't it? Thanks! –  Niels Jansen Jan 25 '13 at 22:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.