I have been searching around how to position this div, but everything goes wrong or nothing happens when I try, so I decided to ask here. Here is the css code of the divs:

我一直在寻找如何定位这个div,但是当我尝试时,一切都出错了或没有任何反应,所以我决定在这里问一下。这是div的css代码:

    #my_content{
    margin-bottom:0;
    background-image:url("bg.jpg");
    width:50%;
    float:left;
    padding:5px;
    color: white;
    font-size:30px;
    }  

    #info_menu{
    margin-left:;
    color: white;
    float:left;
    width:auto;
    margin-top:;
    margin-left:1%;
    padding-right:1%
    }    

    #spells{
    margin-left:5%;
    background-image:url("bg.jpg");
    position:absolute;
    margin-left:;
    width:65%;
    color:white;
    border:none;
    bottom:20;
    }

    #summary{
    background-image:url("bg.jpg");
    border:none;
    float:right;
    position:relative;
    width:30%;
    color:white;
    margin-right:0%;
    bottom:10;
    }

Here is how it looks like http://s27.postimg.org/vwchchcqb/dapls.png

这是它的样子http://s27.postimg.org/vwchchcqb/dapls.png

2 个解决方案

#1


0

First of all, welcome to Stack Overflow.

首先,欢迎使用Stack Overflow。

When asking a question, it is helpful too see all relevant code (and no irrelevant code) - so in your case, we would want the html you are working with. It's also really great to make a jsFiddle like THIS for us to see.

在提出问题时,查看所有相关代码(并且没有相关代码)也很有帮助 - 所以在您的情况下,我们会想要您正在使用的html。为我们制作像这样的jsFiddle也真的很棒。

It's hard to tell from your picture, but here is some code that might lead you to some cleaner practices. Good luck!

从你的图片中很难说清楚,但这里有一些代码可能会引导你进行一些更清洁的实践。祝好运!

@sheriffderek


html

<header>
    header
</header>

<nav>
    <ul class='menu'>
        <li><a href='javascript:void(0)'>menu item</a></li>
        <li><a href='javascript:void(0)'>menu item</a></li>
        <li><a href='javascript:void(0)'>menu item</a></li>
        <li><a href='javascript:void(0)'>menu item</a></li>
    </ul>
</nav>

<div class="group">

    <section class='content'>
        content
    </section>

    <section class='spells'>
        spells
    </section>

</div> <!-- .group -->

<section class="summary">
    summary
</section>


CSS

* { /* look it up */
    box-sizing: border-box;
}

body {
    margin: 0;
}

header {
    width: 100%;
    float: left;
    background: orange;
}

nav {
    width: 100%;
    float: left;
}

.menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu li {
    float: left;
}

.menu a {
    display: block;
    padding: 5px 10px;
}

.group {
    width: 65%;
    float: left;
}

.content, .spells {
    width: 100%;
    float: left;
    min-height: 10em;
}

.content {
    background: gray;
}

.spells {
    background: pink;
}

.summary {
    width: 35%;
    float: right;
    min-height: 20em;
    background: lightblue;
}

更多相关文章

  1. HTML5用户身份认证源代码:注册、登录、会话保持的解决方案
  2. 将PHP代码添加到.html文件
  3. 如何让你的前端代码更像HTML5(用语义元素构造html5)
  4. 如何在CSS中单独定位此HTML代码?
  5. QQ、MSN、淘包旺旺、Skype常设对话的html链接代码
  6. 10段实用的HTML5代码
  7. 用JavaScript实现两种功能:1、切换全选/全不选文字;2、根据选中个
  8. HTML5+学习笔记2-------边看代码边研究貌似还是有点问题...还在
  9. PHP代码在不需要时在Javascript中自动运行[重复]

随机推荐

  1. 2_python连接MariaDB错误
  2. jupyter安装出现问题:安装后无法打开
  3. sklearn进行数据预处理-归一化/标准化/正
  4. 廖雪峰python3.6教程笔记1-Python简介与
  5. python:如何在Linux中编写守护进程
  6. 自学Python1.5-Centos内python2识别中文
  7. Python3 函数式编程(高阶函数)
  8. 开发者实验室体验之文智自然语言处理SDK
  9. Python 3.4:试图让这个模块对这个2d数组中
  10. 在运行期间计算python中GradientBoosting