开发者

When using WebBrowser control how do you have the text appear without margins?

I'm using a System.Windows.Forms.WebBrowser control next to textboxes with the left margins of each control aligned on the same X axis. The appearance however is "ugly" because the WebBrowser control inserts a ma开发者_StackOverflowrgin/padding around the content of the control. Therefore the text in the WebBrowser control is several pixels to the right of the text in the textboxes above and below the WebBrowser control.

How do you fix this? The Margin setting does not appear to work.


What content are you putting inside of the web browser control? If it is HTML that has margins or padding defined (or using the defaults) you could try defining the HTML with no margins or padding around the body and see if that fixes your problem.


I came across this same problem, and an additional thing to watch out for is if your app is going to be installed on computers using IE6. IE6 by default seems to add a border to the left and top sides, which will have the same effect of make the text in your WebBrowser not exactly aligned as you want and with a couple of additional 'ugly' borders as a bonus. html { border:0px } body {margin: 0px; padding:0px;} in the CSS fixed it all for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜