email-bugs icon indicating copy to clipboard operation
email-bugs copied to clipboard

How to change border thickness of VML Buttons

Open burdyga opened this issue 4 years ago • 1 comments

Everyones know the nice tool buttons.cm. This tool allows you to make styled buttons at Outlook App on Windows using VML code. But the problem is if you need to control border thickness, you can't and the border will be 1px weight. I fount the solution for change border thickness: Add the strokeweight="XXpx" for v:roundrect element.

For example: image

Tested code

<div>
    <!--[if mso]>
	  <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://" style="height:40px;v-text-anchor:middle;width:200px;" arcsize="10%" strokecolor="#1e3650" fill="t" strokeweight="4px">
    <v:fill type="tile" src="https://i.imgur.com/0xPEf.gif" color="#556270" ></v:fill>
    <w:anchorlock></w:anchorlock>
    <center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight:bold;">Show me the button!</center>
  </v:roundrect>
<![endif]-->
<a href="https://" style="background-color:#556270;background-image:url(https://i.imgur.com/0xPEf.gif);border:4px solid #1e3650;border-radius:4px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:13px;font-weight:bold;line-height:40px;text-align:center;text-decoration:none;width:200px;-webkit-text-size-adjust:none;mso-hide:all;">Show me the button!</a>
</div>

Testing results image

Keep in mind If you add\change strokeweight attribute, you need to change VML button width and height by adding 2x px of border weight.

burdyga avatar Nov 27 '20 20:11 burdyga

VML borders should use points not pixels, and Outlook's pixel to point conversion is 75% with a minimum 1pt. So if you wanted a 2px border, you'd use 2 x .75 = 1.5pt.

Using points also ensures the border will resize properly in Outlook 120DPI.

ThiesPublishing avatar May 18 '21 15:05 ThiesPublishing