negative margin problem

Discussion in 'CSS' started by ceopz, Aug 11, 2010.

  1. #1
      <div class="calendar-dates"> 
                       <div class="calendar-note">
                      <a href="#">Tryeza e rumbullak&euml;t me kryetar&euml;t e komunave n&euml; Dukagjin</a></div>
                    <div class="calendar-blue"><a >15 KORRIK 2010</a></div>
              </div>
                                    <br style="clear:both" />
    Code (markup):

    .calendar-dates {
    float : left;
    height : 70px;
    position: absolute;
    margin-top: 10px;
    margin-right:-20px;
    width : 240px;
    }
    .calendar-note {
    background : #fff;
    float : left;
    height : 40px;
    padding : 10px;
    text-align : left;
    width : 160px;	
    }
    .calendar-blue {
    background : url(images/right-content.png);
    height : 70px;
    width : 60px;
    float: left;
    }
    Code (markup):
    i have problem with this code i cant get why i cant give negative margin to "calendar-dates" div so there is 2 pics first one shows the problem and second how it need to look.

    thank you all. and sorry for my english
     

    Attached Files:

    • 1.JPG
      1.JPG
      File size:
      6.2 KB
      Views:
      80
    • 2.JPG
      2.JPG
      File size:
      6.4 KB
      Views:
      67
    ceopz, Aug 11, 2010 IP
  2. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Try with deleting float : left; in .calender-dates... no, forget what i said.

    Could you provide a link?

    Want to see the WHOLE thing, not only parts.
     
    CSM, Aug 11, 2010 IP
  3. nikywm

    nikywm Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,
    I do not recommend you to use negative margins. This might cause you problems.
    Since you are using position: absolute; you don't need float: left;

    I think using left/right properties should solve your problem:
    .calendar-dates {
    height : 70px;
    position: absolute;
    top: 10px;
    left: 20px;
    width : 240px;
    }
    Code (markup):
    You can use something like right: -20px; as well
     
    nikywm, Aug 12, 2010 IP