2

My css code for the form,

form {
            margin:0 auto; 
            text-align:left;
            width:740px;
            border:1px solid #ccc;
            padding:15px;
            background:#fff;
            border-radius: 10px; 
            -moz-border-radius: 10px; 
            -webkit-border-radius: 10px; 
            box-shadow: 0 0 4px #ccc; 
            -webkit-box-shadow: 0 0 4px #ccc; 
            -moz-box-shadow: 0 0 4px #ccc;
            behavior: url(./border-radius.htc);
            font-family:Calibri;
            height: auto;
        }

JS Fiddle

I want the form background to expand with the form, its happening in Chrome but not in IE8.

I have some hidden DIV that are set to visible depending on the selections.

Also how can I get CSS formatting of Chrome and IE look alike.

Ex: if I want to make 2 div visible the form will expand accordingly but the thing is the form border does not extend in IE.

Please check out the entire working code in jsfiddle

enter image description here

1 Answers1

0

Create a container div that goes around your form (in this case called formcontainer) and move the following CSS styles to that class.

    .formcontainer{
      border-radius: 10px;  
      -moz-border-radius: 10px; 
        -webkit-border-radius: 10px; 
        box-shadow: 0 0 4px #ccc; 
        -webkit-box-shadow: 0 0 4px #ccc; 
        -moz-box-shadow: 0 0 4px #ccc;  
        border:1px solid #ccc;
        padding:15px;
        width: 740px;
    }

Then your form should have the following css rules:

        form {
        margin:0 auto; 
        text-align:left;
        width:100%;
        background:#fff;    
        behavior: url(./border-radius.htc);
        font-family:Calibri;
        height: auto;
    }

I'm not sure what your behaviour property is doing so you might need to move that to the container div as well.

http://jsfiddle.net/Jzbgj/1/

Aside

Also, your JavaScript may need amending as it displays my age as 25 when I enter my D.O.B when it should be 24.

This may help with your age calculation: Calculate age in JavaScript

Community
  • 1
  • 1
jezzipin
  • 4,110
  • 14
  • 50
  • 94
  • behavior is responsible for displaying rounded edges in browsers like IE. –  Jul 31 '13 at 13:03
  • I'd add that to the container div then although border-radius is what should be used for IE10 now. – jezzipin Jul 31 '13 at 13:04
  • Its done but I am not able to get rounded borders that I used to get using .htc file as you can see in the above screenshot –  Jul 31 '13 at 13:05
  • What are the contents of the .htc file? With things such as rounded borders you should really look at graceful degradation as IE8 will soon be phased out like IE7. – jezzipin Jul 31 '13 at 13:06
  • border-radius is not supported in IE8 is ther any alternative to it? –  Jul 31 '13 at 13:07
  • No it's not supported. With graceful degradation you would just use run of the mill squared borders. – jezzipin Jul 31 '13 at 13:10
  • No worries. If this answer has helped, please remember to mark it as correct! I've added a link that might help with the age in my answer. – jezzipin Jul 31 '13 at 13:13
  • 1
    Hay thanks for the link and here you go marked the answer as correct –  Jul 31 '13 at 13:15