3 Replies - 326 Views - Last Post: 15 September 2013 - 10:17 AM Rate Topic: -----

#1 magicm00n  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 114
  • Joined: 01-March 12

Set width & height to img links

Posted 14 September 2013 - 04:58 PM

This is the img link in my php code:
<img src=\"".htmlspecialchars_uni($row['avatar'])."\" />


How can I set the width and height? I also want to add the "vertical-align:middle;" style.

I tried to add a span style tag to the img but that didn't work. Help me please :3
Is This A Good Question/Topic? 0
  • +

Replies To: Set width & height to img links

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3741
  • View blog
  • Posts: 13,082
  • Joined: 12-December 12

Re: Set width & height to img links

Posted 14 September 2013 - 05:04 PM

Set the width and height attributes in the same way as you are the src attribute.

You could also add a style-attribute:

style="vertical-align:middle;"

but it is far better that you do this in the css, perhaps giving the element a class-name.

However, I suspect that you haven't provided enough information in your question.
Was This Post Helpful? 0
  • +
  • -

#3 magicm00n  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 114
  • Joined: 01-March 12

Re: Set width & height to img links

Posted 14 September 2013 - 09:13 PM

Nvm I've solved it ^^! To add span tags in php is different. Have to add back slashes or it won't work.
Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3077
  • View blog
  • Posts: 10,792
  • Joined: 08-August 08

Re: Set width & height to img links

Posted 15 September 2013 - 10:17 AM

View Postmagicm00n, on 15 September 2013 - 12:13 AM, said:

Nvm I've solved it ^^/>! To add span tags in php is different. Have to add back slashes or it won't work.

You need to learn the difference between server and client side code: PHP (server side) does not have span tags. HTML (client side) does. You should be posting style questions in HTML && CSS.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1