tags:

views:

30

answers:

2

I've got the following html:

    <html>
<body>

<div id="note1" class="note">
    <div class="note-header">Note</div>
    <div class="note-content"></div>
</div>

</body>
</html>

with css:

body {
    background-color:black
}
.note {
    width: 150px;
    height: 150px;
    background: #111111;
}
.note h4 {
    text-align: center;
}
.note-header {
    background: #0b3e6f;
    color: #f6f6f6;
    font-weight: bold;

}
.note-content {
    height: 100%;
    width: 100%;
}
.note-editor {
    width: 100%;
    height: 100%;
}

And javascript that adds iframe to div.note-content:

$(function() {
    $("#note1").resizable().draggable({handle: ".note-header"});
    $('#note1').children('.note-content').append('<iframe id="rte" class="note-editor" ></iframe>');
    $('#rte').contents().attr("designMode", "on");
});

The problem is that iframe size apears to be bigger then div.note-content size. Parent div is resizable. how can i make iframe fit in div.note-content? JSFiddle: http://jsfiddle.net/TTSMb/

A: 

WHy don't you specify a size on the iframe itself? That should most likely solve your issue here

Claudiu
parent div is resizable, i should've wrote this in my question... ofcourse i can change iframe size on div resize, but i thought there could be i nicer solution with css.
Denis
what if you specify width and height to be 100% on the iframe?
Claudiu
it is 100%... i tried make it less %, but still no luck
Denis
i think that's the best solution. i changed iframe size on div resize.
Denis
Thanks, I'm glad it's working :)
Claudiu
+1  A: 

The problem is that the iframe takes the size of the parent, of class note-content which takes the full size (width 100%, height 100%) of its parent note1. But note1 contains another div as well.

You need to change the height of the note-content.

GôTô
i guess you're right. but is there a way to fix it css-way?
Denis
I don't know if you can set the height to the remain height. You could always set the overflow to hidden on the note1 div but doing so would cut the iframe instead of setting it to the proper size. You could set manually the height of the handle, that way you would know the height to set to the note-content.
GôTô