开发者

aligning <div> data in one line?

<div id="surve开发者_StackOverflowyTitleEdit" style="float:left;overflow: auto;">
   <input id="surveyTitleInput"  size="25" type="text" name="Title" />
   <span><img class="pointerCursor" src="image" alt="Save" title="Save"
              onclick="save()"/></span>
   <span><img class="pointerCursor" src="image" alt="Save" title="Save"
              onclick=Edit();"/></span>
</div>

This is my code, I'm getting input box and first image in one line and the second image in another line , I want all the div data in one line , how can i achieve this?


Try this:

<div id="surveyTitleEdit">
 <input id="surveyTitleInput" size="25" type="text" name="Title"/>
 <img src="" alt=""/>
 <img src="" alt=""/>
</div>

Now the only thing you have to make sure of, is that the div surveyTitleEdit is wide enough (has a width higher than the sum of the widths of the input and two images) to contain the 3 elements next to each other. Alternatively you can use the following CSS:

#surveyTitleEdit {
 white-space: nowrap;
}


It should be onclick="Edit();". You forgot a ". Elements should be automatically aligned if the div container is wider enough. Whenever possible, avoid to attach events directly to TAGS. Instead, you can use jQuery (Or other frameworks) events.


Try specifying the height and width in the , as in:

<img src="image.jpg" width="200" height="150">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜