php - Scale images using CSS -
I am creating a "Recent Blog Post" module where you can see the user submitted posts with images. My point is that I do not want the height of the images to exceed 400 pixels. How can I scale the image and focus it?
& lt; Div class = "feed" & gt; & Lt; Div class = "feed-image" & gt; & Lt ;? Php preg_match ('/ & lt; img. + Src = [\' "] (? P & lt; src & gt;) [\ '"]. * & Gt; / i', $ line ["content" ], $ Image); Echo '& lt; Img src = "'. $ Image [' src ']." "& Gt; '? & Gt; & lt; / div & gt; & lt; / div & gt;
You can simply set the maximum-height element to the image 400px CSS .feed-image img {max-height: 400px; width: auto; margin: 0 auto;} The maximum-height element allows flexibility in image size, while margin: 0 automatically focuses images p>
Comments
Post a Comment