• Hello everyone,
    I have a little problem, I would like to be able to remove the white space below images in my blog in a few posts, like this one:
    https://news.davidshama.com/?p=411
    and keep it in other posts like this one:
    https://news.davidshama.com/?p=486

    The problem is that if I change the line-height to 70% in <p> in the css it works but it’s also suppressing the space between lines of text of the entries.

    I am looking for a way to independently control images…

    Anyone have an idea?
    Thanks for your help
    D.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Unfortunately, the theme you are using does not contain the hooks (classes/ids) necessary to style content on an individual post basis.

    Thread Starter davidismyfriend

    (@davidismyfriend)

    well thanks for answering, but i built that theme actually so I am asking where to put the hooks basically. probably in my loop?

    In that case, I’d suggest that you read up on the body_class and the post_class functions.

    I’d also recommend that you validate your site. For example, there’s no such tag as <p4>.

    Thread Starter davidismyfriend

    (@davidismyfriend)

    Thanks, I’ll do that, yes the p4, I’ll get rid of that, it’s the first time I code, so I am pretty happy it works…
    So if I understand it well, I add get_post_class() in my fonction.php or index.php and I get all the prerecorded wordpress classes to be used in my css??
    But there is no class in the list affecting only images…

    no, what you need is a <body> tag in the header.php, then to add the code that will automatically add class to the body tag. (look at the default twenty-ten theme and copy it).
    And add a css class to images in your template files, different ones on different pages. That will give you lots of hooks. Then, in your css, you can control images depending on category, post type, or such.

    So the classes would like:
    <body class="mycategory">
    and on one category template you could have:
    <img class="nospaceimages">
    but on another category template you could have:
    <img class="lotsofspace">

    And your css could have lines like this:

    body.category-mycategory, img.nospaceimages {margin:0;padding:0;border:0;}
    img.lotsofspace{margin:1em;}

    Thread Starter davidismyfriend

    (@davidismyfriend)

    Thanks a lot, I will try this…
    when you say ” then to add the code that will automatically add class to the body tag”
    are you are talking about <body <?php body_class(); ?>> ?
    When I add this it changes all the layout, My content is no more centered even if I add margin-left:auto, margin-right: auto,
    and my hr’s are cut to the end of the body…
    I am a bit lost there…

    your theme is already using a css class .home – which is one of the output of body_class() – therefore clashing with existing styles.

    (.date would be another one)

    try and change this:

    .home{
    	margin-right:20px;
    	font-family: "Courier New", Courier, monospace;
    	float: left;
    
    }

    to:

    #colophon .home{
    	margin-right:20px;
    	font-family: "Courier New", Courier, monospace;
    	float: left;
    
    }

    and this:

    .date {
    	margin-right:400px;
    	...etc...
    	top: 5px;
    }

    to:

    #post .date {
    	margin-right:400px;
    	...etc...
    	top: 5px;
    }

    Thread Starter davidismyfriend

    (@davidismyfriend)

    Thanks, It worked!!
    I have another question,
    is it possible to for the text-paragraph to dynamically change width when the window is narrower?
    So that the text never goes out of the window?
    Keeping in mind that I don’t want the pictures to do the same and go one under the other…
    I tried to put a class to the text and put min-width: 500px, max width: 1000px but it doesn’t change anything, i figured it was because the body, post, entry and header sizes are all fixed to 1000px width, so I tried changing those to min-width: 500px, max width: 1000px but it’s affecting the picture posts, and not only that, my alignment is all broken and now everything aligns to the left….
    So how would it be possible to do that?
    Thanks again for all the help!
    D.

    Thread Starter davidismyfriend

    (@davidismyfriend)

    I am talking about the second post that is all text : https://news.davidshama.com/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Space between images in my blog’ is closed to new replies.