Title: include css in php ( max-height, max-width for post thumbnail )
Last modified: August 22, 2016

---

# include css in php ( max-height, max-width for post thumbnail )

 *  Resolved anonymized-13749270
 * (@anonymized-13749270)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/)
 * hello everyone.
    i am creating my own theme and i am trying to set a max-width
   and max-height for post thumbnails in functions.php i found this php tag: `set_post_thumbnail_size(
   80, 80, false);`
 * but i want to use max measures not fixed ones..
    is there any way to include 
   CSS inside that php tag ? i already have this in my css file :
 *     ```
       .post-thumbnail, .attachment-post-thumbnail {
           max-height: 300px;
           max-width: 540px;
       }
       ```
   
 *  but since it is a post thumbnail they add html `height="" width=""`
 * any help is kindly appreciated !
    ^ sam

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 7 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/#post-5445865)
 * reset it with CSS: “width: auto; height auto”
 *  Thread Starter anonymized-13749270
 * (@anonymized-13749270)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/#post-5445866)
 * thank you **andrew** for the quick reply.
    i did that and it still adds this :`
   <img width="1920" height="1200" src="//" class="attachment-post-thumbnail wp-
   post-image" alt="//">` i want to use CSS only ( `class="attachment-post-thumbnail"`),
   so how can i get rid of `width="1920" height="1200"` thank you sir 🙂
 *  Thread Starter anonymized-13749270
 * (@anonymized-13749270)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/#post-5445867)
 * thank you sir.. i figured out a solution.. thanks for assisting me 🙂
 *  [TheTreeCraft](https://wordpress.org/support/users/thetreecraft/)
 * (@thetreecraft)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/#post-5446215)
 * [@samuel](https://wordpress.org/support/users/samuel/) Elh
 * Hi, I am facing the exact same problem.
    Would appreciate it if you could share
   your solution.
 * Best,
    TheTree.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 10 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/#post-5446216)
 * The exact solution was this:
 *     ```
       .post-thumbnail,
       .attachment-post-thumbnail {
           width: auto;
           height auto;
       }
       ```
   
 * If you’re not creating your own theme then I don’t think you have the exact problem.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘include css in php ( max-height, max-width for post thumbnail )’ is closed
to new replies.

## Tags

 * [css](https://wordpress.org/support/topic-tag/css/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [post-thumb](https://wordpress.org/support/topic-tag/post-thumb/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/include-css-in-php-max-height-max-width-for-post-thumbnail/#post-5446216)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
