- This topic is empty.
-
AuthorPosts
-
August 29, 2013 at 7:31 am #148500
middayminer
ParticipantHello, I’ve set up some left and right padding for my wordpress post text which makes it more readable via shorter line width, but unfortunately styling p will also pad the full width images in the post with the same settings, making the browser auto-scale them down.
Other than manually using span each time with the desired settings for each paragraph(which also doesn’t quite work for me, it’s just indenting the first line for some reason), is there any way to keep the padding for my text while not affecting the images?
Thanks guys!
August 29, 2013 at 8:27 am #148505Senff
ParticipantAugust 29, 2013 at 9:56 am #148510middayminer
ParticipantHi Senff, thanks for that link! I really thought it’ll do the trick, but the issue remains. I’m using the Dynamik theme for the Genesis framework, so I think I’ll check with tech support to see if this is a known issue. You have given me a great place to start though!
August 29, 2013 at 10:02 am #148511Tom Houy
ParticipantIf you use margins instead of padding for the text, you could create a style for IMG tags that are within P tags and reset the margins on them to zero by using negative values equal to the padding, or whatever you like. Something like:
.mystyle p img { margin-top: -20px; margin-right: -20px; margin-bottom: -20px; margin-left: -20px; }
You can’t use negative values for Padding.
August 29, 2013 at 10:28 am #148515middayminer
ParticipantHi Tom, I just tried your method out. Here’s what happened:
.entry-content p {
margin-left: 12px;
margin-right: 12px;
}
(What I’m trying to implement here. It scales down by 24px any images reaching the full width of the content area).entry-content p img {
margin-left: -12px;
margin-right: -12px;
}
(the new bit)Margin styling the img tags seems to only alter their position for me, not ‘rescale’ them, so to speak. For example if I add an value like margin-left: -160px, images start clipping out of the content area instead of shrinking in size.
August 29, 2013 at 10:46 am #148520Tom Houy
ParticipantIt’s kind of a WordPress annoyance/convenience depending on how you look at it, but you can read more about the issue here:
http://wordpress.org/support/topic/prevent-wordpress-from-wrapping-p-tags-around-images
Another option would either be to remove the P tags after you insert an image, I suppose.
August 29, 2013 at 10:48 am #148521middayminer
ParticipantGreat, now I need to see if there’s a code snippet to add said div tags for images. :)
edit: lo and behold http://ahjira.com/stop-wordpress-from-wrapping-images-in-p-tags/
edit 2: Doesn’t work for me. Losing sunny disposition.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.