开发者

div width problem...problem is cross browser

开发者 https://www.devze.com 2023-02-07 09:57 出处:网络
I have a div having two buttons inside it as |Add| and |Cancel|. I didnt set any width to that div intially and as开发者_如何学Python a result they were displayed vertically not in horizontal.then i a

I have a div having two buttons inside it as |Add| and |Cancel|. I didnt set any width to that div intially and as开发者_如何学Python a result they were displayed vertically not in horizontal.then i add width in % to 11.5%.now the display is ok in moz but not in chrome and ie.i cant use pixels neither in height nor width.problem explanied by example


|_______| // a textbox

|Add| //initially with no width |Cancel|

//after width to 11.5% in moz


|_______|

 |Add| |Cancel|

//after width to 11.5% in chrome and ie


|_______|

|Add| |Cancel|

so u can see that in moz it is aligned to the above textbox but not in ie and chrome.hope sum ie hack or chrome hack may lead to correct result..or ONLY a MOZ hack..


It is probably because by default, if left to their own will, different browsers render things differently.

You should use CSS resets so the default behavior of most browsers will be the same.

Have a look here


You can give display:inline;to the div that you added buttons and giv width to width:auto;.If you specify the width for Div, it'll not display in chrome.Use space between px like margin-left:10 px.You can validate your errors using validation toolbar.It will be very useful to specify the mistakes in CSS.

0

精彩评论

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