html - 格式化图像//HTML

标签 html css image web

现在,在布朗大学的 NLCC,我和我的导师正在尝试在 psiTurk Stroop 任务的底部包含图像;我们正在与该元素的开发分支合作。

我们的目标是让一行三张图片显示如下: http://i.stack.imgur.com/4IjNG.png

除了在右侧和左侧框上显示红色和绿色框。 但是,当我尝试包含代码以便在 test.html 页面底部显示框时,这就是我的浏览器中出现的内容。 http://i.stack.imgur.com/LKGfk.png

我尝试使用的代码如下:

h1>Test Phase</h1>
<div id="instructions">What color is this word?</div>
<div id="stim"></div>
<div id="query"></div>

<p id="PDisplay"> </p>
<p id="TDisplay"> </p>
<p id="RDisplay"> </p>
<div style = "position: absolute;
left:50;"><img id="Lred" src="static/images/red.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:50;"><img id="Lblank" src="static/images/blank.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:50;"><img id="Lgreen" src="static/images/green.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:370;"><img id="Ccue" src="static/images/cue.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:370;"><img id="Cblank" src="static/images/blank.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:370;"><img id="Ctarget" src="static/images/target.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:690;"><img id="Rred" src="static/images/red.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:690;"><img id="Rblank" src="static/images/blank.jpg" IMG HEIGHT = 150/></div>
<div style = "position: absolute;
left:690;"><img id="Rgreen" src="static/images/green.jpg" IMG HEIGHT = 150/></div>

我认为可能有一个元素将图像推到只显示在左 Angular 。为了解决这个问题,我尝试操纵页面的 css,但我删除了整个工作表,除了主体的 CSS,所有图像仍然显示在左侧。为了以防万一,这里是 css 的样子:

@import url(http://fonts.googleapis.com/css?family=Crimson+Text:400,600italic);

body {
    /* background: #999; */
    background: black; /* #808090; */
    color: white;
    text-align: center;
    font-family: Verdana, Helvetica, sans-serif;
    margin: 0 auto;
        margin-top: 100px;
    width: 800px;
}

h1 {
        font-family: "Crimson Text";
        font-size: 42pt;
        font-style: italic;
}

a {
    color: #FFCC90;
}

.warm {
    color: #DDAA90;
}

.cool {
    color: #ccccff;
}

strong {
    font-weight: bold;
    color: #DDAA90;
}


/* Instructions */

#main {
    margin: 0 auto;
    width: 800px;
    font-size: 100%;
}

.continue  {
        font-size: 2em;
    width: 5em;
        height: 2.5em;
    margin: 20px 20px;
}

.instruct p {
    text-align: justify;
}

.instruct .prompt {
    text-align: center;
    font-style: italic;
    font-size: 100%;
    margin: 0 auto;
    margin-top: 30px;
    width: 500px;
}


/* Questionnaire */

input {
        width: 200px;
        height: 50px;
        font-size: 22pt;
}

.questionnaire {
    text-align: center;
}

.questionnaire .continue {
    margin: 0 auto;
    margin-top: 20px;
}

.questionnaire h1 {
    text-align: center;
}

.questionnaire p {
    text-align: left;
}

.questionnaire #warning {
    color: red;
    font-weight: bold;
}

.questionnaire table {
    margin: 0 auto;

    /* Border stuff: */
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0.25em;
    border: none;
}

.questionnaire tr {
    display: block;
    border-bottom: 1px dashed white;
}

.questionnaire tr:last-child { border: 0; }

.questionnaire td {
    padding-right: 0.25em;
    vertical-align: middle;
    border-width: 0 1px;
    border: none
    margin: 20px;
    padding-bottom: 10px;
}
.questionnaire td:first-child, td + td {border-left: 0; }
.questionnaire td:last-child { padding-right: 0; border-right: 0; }

.answer {
        text-align: left;
    padding-left: 3em;
}

.questionnaire .questiontext {
    vertical-align: top;
        width: 300px;
        margin: 20px;
        font-size: 1.2em;
}
.questiontext em {
    font-size: 70%;
}
.questionnaire textarea {
    width: 320px;
    height: 130px;
}
.questionnaire form {
    text-align: right;
}
.questionnaire ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.questiontext {
    text-align: right;
}


/* Debriefing form */

#debriefing {
    width: 640px;
        margin: 0 auto;
}

#debriefingtext {
    margin: 0 auto;
    padding: 10px 20px;
    font-size: 90%;
    text-align: justify;
}
#affirmationbox {
    position: relative;
    margin:  0 auto;
    border: 1px dotted white; 
    padding: 10px 20px;
    vertical-align: middle;
}
#affirmationbox p {
    text-align: left;
    font-style: italic;
}
#affirmationbox  table {
    border-spacing: 20px;
}
#affirmationbox  td {
    vertical-align: middle;
    font-size: 100%;
    color: black;
    height: 50px;
    cursor: pointer;
}
#affirmative {
    background: white;
    overflow: hidden;
    font-weight: bold;
    width: 10em;
}
#negative {
    background: white;
    font-size: 100%;
    width: 25em;
}

我想知道 HTML 中是否有另一个元素或代码的某些其他属性限制了图像的放置。

最佳答案

为什么不直接让元素向左浮动而不是使用绝对位置

尝试

<div style="float:left;">

而不是 <div style = "position: absolute;left:50;">

关于html - 格式化图像//HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18129605/

相关文章:

html - 使用 css 限制下拉列表中显示的选项

python - Flask网页找不到图片文件

javascript - 为什么 onmouseout 在选择标签内调用每个选项更改

html - 在父宽度和最大宽度之间设置子宽度

javascript - iFrame 大小随内容动态变化

html - 如何在 anchor 中添加图像

java - 在 AWT Canvas 上绘制图像

javascript - 必应图像搜索 API

php - 文件位置问题

javascript - 如何根据地址动态 `generate` 谷歌地图?