0

Hey guys!

I know this might sound strange, but I am trying to use CSS to format a P section to be centered, but only if that P contains an embedded video.

Is there a CSS statement I can use to apply formatting to only those P's that contain OBJECT's (embedded videos)?

Basically, I'm trying to modify the parent based on the child...

Thanks a ton!

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by diafol
0

Basically, I'm trying to modify the parent based on the child...

As far as I am aware there is no way to do this with html/css alone.

Is the page being built dynamically using data base info or something? You can't just apply a class to that specific p tag?

Your best bet might be to use php or java, depending on how the content is put into the page, in order to apply a class to the p tag.

-David

0

Its a wordpress blog where the client is writing their own articles but they know nothing about HTML/CSS - so it has to automatically center the embedded video for them.

Unfortunately, I dont know enough about PHP to re-configure how wordpress builds the page when they publish an article.

Thanks for the suggestions.

0

Its a wordpress blog where the client is writing their own articles but they know nothing about HTML/CSS - so it has to automatically center the embedded video for them.

Unfortunately, I dont know enough about PHP to re-configure how wordpress builds the page when they publish an article.

Thanks for the suggestions.

You might try posting on the wp forum for a way to customize the loop output based on the content in a post, but it's going to be tough to find a solution that doesn't require you to modify the php.

Good luck.

0

If the object is automatically placed in a p (or div), centring the object via the centre/center! align button on the WYSIWYG editor should do the trick. Objects themselves don't centre, so I understand the use of p. Some blogging platforms allow you to chose between p and div for new input. Both should work with the align buttons.

0

@ardav and @nizuya: guys, thanks a ton for the input. I actually figured out how to make it work and it was super-simple. I just needed to set the OBJECT to display:block and then the margin:auto worked. Don't know why I didn't think of that sooner.

0

Nice one. Although - had issues with margin:auto in order browsers. Still had to centre-align the outer tag.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.