• Hi,
    I have a Problem which is probably simple and stupid, but I cannot solve it, not even by searching google for about 3 days.
    So I decide to ask.

    My Page is still http://www.Pagesonceblank.com. The Theme I built myself, it is very barebone, and somewhat weirdly implemented into the page. Everything works as I want it to work, except:

    In my stylesheet, I try to resize the Pictures in the Post dynamically.

    #inhalt img {
    
       max-width: 100%;
    	Height: auto;
    }

    I also tried width: 50%; , a method that works everywhere else on the page. Here, it makes the picture half as big, but when I shrink the browser window, the Pictures in my post stays the same size, unlike any other pictures I used the same method on.

    Since the method can hardly be at fault, I strongly suspect I messed up somewhere stupid. My Code for the post looks somewhat like this:

    <div id="text">
        <div id="inhalt">
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Der Verweis (Permalink) zu: <?php the_title(); ?>"><?php the_title(); 
    
    ?></a></h2>
    
                <div class="beitrags-info"><p2>Von <?php the_author_posts_link(); ?>  am <?php the_time('d. F Y'); ?> um <?php the_time('H:i'); ?><?php edit_post_link(); ?></p2></div>
    
                <div class="der-beitrag"><p><?php the_content(); ?></div> <!-- Ende des jeweiligen Beitrags --></p>
    
    	<p class="postmetadata"><p2>Posted in <?php the_category(', '); ?></p2><div class="feedback"><p2><?php comments_popup_link('Kommentare 
    
    (0)', 'Kommentare (1)', 'Kommentare (%)'); ?></p2>
    
    <br><br><br><br><br>
    
    </div>
                <!-- Ende des jeweiligen Beitrags -->
    <?php comments_template(); /* Der Kommentarbereich */ ?>
    
    <?php endwhile; else: ?>
    <p>Tut mir leid, es wurde kein passender Beitrag gefunden.</p>
    <?php endif; ?>
    
                <p><?php posts_nav_link(' - ', '« Zurückblättern', 'Weiterblättern »'); ?></p>
    </div>

    Please help me!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Phaederkiel

    (@phaederkiel)

    What is really weird is that I seem to have the correct place to change the images size, since I can change the width there unresponsively;

    and on the other hand I use a method which works everywhere else in the code. So what do I do wrong? I do not understand.

    Thread Starter Phaederkiel

    (@phaederkiel)

    I kinda found a solution myself:

    After discarding the possibility that my method was wrong (works everywhere else); Or that selection of the pictures did not work (other methods work with the selection), I kinda deduced that the problem lies in the Pictures itself.

    The only way that the pictures in the post differ from the other pcitures on the site is that they are added by wordpress.

    So I looked at my Edit Post Menu and righ-klicked the picture and found that there is a percentage size option (which doesnt do anything) and that there is (under advanced options) a field that gives tells us about the size of the picture used.

    I put 100% in both height and width, and now everything works as I wanted.

    So that means that for some reason my CSS is not able to overwrite some of the formating WP does on my pictures. Is there any way to change that?

    Thread Starter Phaederkiel

    (@phaederkiel)

    For completeness sake:

    here i found the snippet that changes that.
    http://wordpress.stackexchange.com/a/37768/17599

    more specifically:

    img[class*="align"],
    img[class*="wp-image-"] {
        height: auto; /* Makes sure images with WordPress-added height and width >attributes are scaled correctly */
    }

    I do not know if I need the rest of the snippet too, will test.

    I still do not understand why I needed to do that. Should not my code at #inhalt img be more specific and later and thus overwrite the wordpress formating? I even tried it with !important, nothing happened.

    perhaps someone can still enlighten me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Neither Width nor Max-width work dynamically for the Images within the post’ is closed to new replies.