0

これは私のdivにコンテンツが表示されないhtmlコードです。Tetxtarea、チェック ボックスは表示されますが、これまでに書いたテキストは表示されません。

また、画面の中央に配置しない画面の中央にdivを作成するCSSを作成しました。

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Creating Popup Div | istockphp.com</title>
<link href="style.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"> </script>
<script type="text/javascript" src="script.js"></script>

<style type="text/css">
.center{
    position: absolute;
    height: 50px;
    width: 50px;
    background:red;
    top:calc(50% - 50px/2);
    left:calc(50% - 50px/2);
}
</style>
</head>
<body>
    <a href="#" class="topopup">Click Here Trigger</a>


    <div id="toPopup" class="center"  style="background-color: #EDEFF1; height:300px;width:500px; -moz-border-radius-bottomright: 15px; border-bottom-right-radius: 15px; -moz-border-radius-bottomleft: 15px; moz-border-radius-topleft: 15px;moz-border-radius-topright: 15px; border-bottom-left-radius: 15px; ">

        <div class="close"></div>
        <span class="ecs_tooltip">Press Esc to close <span class="arrow"></span></span>
        <div id="popup_content"> <!--your content start-->
        <p><b>Share post </b></p>
            <textarea style="height:65px;width:400px;">
            </textarea> <br>         
            <input type="checkbox"> - Facebook <hr> </input>
            <input type="checkbox"> - Twitter  <hr>
            <input type="checkbox"> - Linked in <hr>
            </br></br>                
        </div> <!--your content end-->    
    </div> 
</art>
</body>
</html>

JSFミドルリンク:

http://jsfiddle.net/UD3U7/

jsfiddle では、テキストが表示されます。実際には、div はむしろ直接表示されるはずです。jsfiddle で見ることができます。

しかし、私のローカルホストでは、div のテキストが表示されませんでした。

4

4 に答える 4

1

「私が書いたテキストが表示されなかった」という意味がわかりませんが、css と html を修正して、ポップアップ div をページの中央に配置できるようにしました。

CSS ファイルがある場合は、すべてのスタイル設定を CSS ファイルに入れます。コードのデバッグと保守に問題が生じるため、HTML と CSS でスタイルを組み合わせて使用​​しないでください。

更新されたフィドルは次のとおりです。http://jsfiddle.net/JJ5rx/

HTML:

<a href="#" class="topopup">Click Here Trigger</a>

<div id="toPopup" class="center">
    <div class="close"></div>
    <span class="ecs_tooltip">Press Esc to close <span class="arrow"></span></span>
    <div id="popup_content"> <!--your content start-->
        <p><b>Share post </b></p>
            <textarea cols="50" rows="5" placeholder="Enter comment..."></textarea> <br>

            <input type="checkbox"> - Facebook <hr> </input>
            <input type="checkbox"> - Twitter  <hr>
            <input type="checkbox"> - Linked in <hr>
            </br></br>

    </div> <!--your content end-->

</div> 

CSS:

.center{
  margin: 0 auto;
  background-color: #EDEFF1; 
  height:300px;
  width:450px; 
  -moz-border-radius-bottomright: 15px; 
  border-bottom-right-radius: 15px; 
  -moz-border-radius-bottomleft: 15px; 
  moz-border-radius-topleft: 15px;
  moz-border-radius-topright: 15px; 
  border-bottom-left-radius: 15px; 
}
于 2013-10-09T07:12:08.870 に答える