Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6934289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:56:26+00:00 2026-05-27T11:56:26+00:00

I am building responsive theme for WordPress and i ran into a trouble with

  • 0

I am building responsive theme for WordPress and i ran into a trouble with responsive images. The thing is that i need to alter the size of the image that are inside the content. My logic does say that i should use filter for that, but i couldn’t find one to target images specifically.
My first thought was to use a JS lib for that but this particular one wants to get the name of both big and small images and since my website is using some custom media sizes i didnt find a way to properly get the name of the small image.

The other way is to use css

img {
 max-width: 100%;
}

but again what i need to do is to remove the width and height attribute from img tag.

So basically both methods require me to go through content and parse out image tags and then replace them with newly generated ones.

I did some digging in different plugins sources and found that they filter the_content and just use regex to find img tags and replace them with new.

So i am looking for a solution to make this work the right way because i have a feeling that going through whole content just to replace images isnt the right way.
if there isn’t any better way to do it could someone please help me with the code (especially regex) to solve my little problem. basically i need to search out img tags and remove width and height attributes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:56:27+00:00Added an answer on May 27, 2026 at 11:56 am

    The CSS will easily override the inline img tag, just use

    #.. img{
    
    height:auto;
    width:100%;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In building my responsive website I have come across a bug that appears only
In building a content management system that incorporates jquery ajax into it's GUI I
I'm building an SMS call and response system in a new app that receives
building a site using PHP and MySQL that needs to store a lot of
Building a website that has English & Japanese speaking users, with the Japanese users
I am building a trading portfolio management system that is responsible for production, optimization,
We're building some Java objects that are exposed via BlazeDS to our flex client
I am building a mobile site that works like a slideshow. There are a
I am building a custom component for my webapp that will benchmark each service,
I am building a java server that needs to scale. One of the servlets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.