本文将为您提供关于html–使图像保持在同一位置的div内的详细介绍,我们还将为您解释html让图片在同一个水平线上的相关知识,同时,我们还将为您提供关于css–文本更改时,div和文本框未在同一位置
本文将为您提供关于html – 使图像保持在同一位置的div内的详细介绍,我们还将为您解释html让图片在同一个水平线上的相关知识,同时,我们还将为您提供关于css – 文本更改时,div和文本框未在同一位置对齐、css – 缩放图像保持纵横比,然后在流体高度和宽度DIV内垂直和水平居中、HTML + CSS:如何强制div内容保持一行?、html – Bootstrap:如何让输入框和按钮保持在同一条线上?的实用信息。
本文目录一览:- html – 使图像保持在同一位置的div内(html让图片在同一个水平线上)
- css – 文本更改时,div和文本框未在同一位置对齐
- css – 缩放图像保持纵横比,然后在流体高度和宽度DIV内垂直和水平居中
- HTML + CSS:如何强制div内容保持一行?
- html – Bootstrap:如何让输入框和按钮保持在同一条线上?
html – 使图像保持在同一位置的div内(html让图片在同一个水平线上)
我想让弹跳箭保持在完全相同的位置,这取决于观众的电脑尺寸屏幕,但我无法弄明白.我尝试了很多东西,比如造型的位置,但最终还是脱离了div.
<divid="home"> <h1>HELLO!<h1>MY NAME IS</h1></h1> <br> <ahref="#work"> <img id="angleDown"width="60px" height="60px" alt="" src="img/angle-down.png" /></a> </div>
这是我用于div的风格
#home { background: url('img/img-home.jpg') no-repeat center; background-size: cover; background-repeat: no-repeat; height: 100vh; text-align: center; padding-top: 13.4%; }
任何帮助,将不胜感激!谢谢.
解决方法
.smoothScroll{ position: absolute; bottom: 0px; left: 50%; margin-left: -30px; }
因此总是在图像的底部,是你想要的?
css – 文本更改时,div和文本框未在同一位置对齐
但现在问题是文本框已对齐,我已将选择列表放在每个文本框的旁边.
但问题是,当我在文本框之前更改标签或文本时,所有形成都会受到干扰,并且它不会以相同的格式对齐.
我希望无论我在文本框之前写的文字,文本框的位置都不应该改变. (一个文本框应该在另一个位置相同)
fiddle demo
代码:
.divkl { display: inline; margin: 20px; } .blockl{ width: 100%; display: block; padding:3px; } .txt_prd_add { width:100px; border-radius:0px !important; margin-left:10px; margin-top:4px; } .select_prd { width:85px; margin-top:4px; }
解决方法
<label>Material</label> .title { display: inline-block; width: 80px; }
css – 缩放图像保持纵横比,然后在流体高度和宽度DIV内垂直和水平居中
目标是在缩放图像时保持纵横比,并使其在DIV内垂直和水平居中,而DIV仅由百分比定义.图像需要保持最佳匹配,因此如果需要最大宽度,则使用它,反之亦然.
使用Firefox 33版(或一些早期版本)来查看这个js小提琴,看它是否正常工作:
http://jsfiddle.net/3vr9v2fL/1/
HTML:
<div id="imageviewer" > <div></div> <divid="imagevieweroriginal"> <imgsrc="http://chrisnuzzaco.com/couch/uploads/image/gallery/smiling_woman_wearing_drivers_cap.jpg" alt="Doctor Concentrating on Work"></img> </div> </div> </div>
CSS:
#imagewrapper{ position:absolute; width:69%; height:100%; top:0px; bottom:0px; background-color:gray; } #imageviewer{ position:relative; width:100%; height:100%; } .responsive-container { position: relative; width: 100%; border: 1px solid black; } .dummy { padding-top: 100%; /* forces 1:1 aspect ratio */ } .img-container { position: absolute; top: 0; bottom: 0; left: 0; right: 0; } .centerer { text-align:center; /* Align center inline elements */ font: 0/0 a; /* Hide the characters like spaces */ } .centerer:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; } .centered { vertical-align: middle; display: inline-block; max-height: 100%; max-width: 100%; }
问题:
我最初在stackoverflow上找到了我的代码,并创建了一个简单的mod,为.centered类添加了max-height / width.当时,这适用于所有主流浏览器.唯一的例外是Opera.
Vertically align an image inside a div with responsive height
但是有一个很大的问题:最新版本的Chrome(版本38.0.2125.111)不再适用于此代码,我的用户更喜欢使用Chrome浏览器.
关于如何解决这个问题的任何想法?这是Chrome的错误吗?我愿意接受javascript建议,以便再次使用.
解决方法
.container { position: absolute; top: 0; left: 0; bottom: 0; right: 0; width: 100%; height: 100%; } .image { position: absolute; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%,-50%); } body { width: 100%; height: 100%; position: absolute; margin: 0; }
<div> <imgsrc='http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-140mmf_35-56g_ed_vr/img/sample/sample1_l.jpg'> </div>
图像水平和垂直居中.如果缩小窗口,则图像会缩小原始宽高比.
我没有在所有浏览器上测试它.
HTML + CSS:如何强制div内容保持一行?
如何解决HTML + CSS:如何强制div内容保持一行??
尝试这个:
div {
border: 1px solid black;
width: 70px;
overflow: hidden;
white-space: Nowrap;
}
解决方法
我在a中有一个长文本,其中div
包含definewidth
:
HTML:
<div>Stack Overflow is the BEST !!!</div>
CSS:
div {
border: 1px solid black;
width: 70px;
}
我怎么能迫使字符串留在一行中(即在“溢出”中间被切掉)?
我尝试使用overflow: hidden
,但没有帮助。
html – Bootstrap:如何让输入框和按钮保持在同一条线上?
您可以在此屏幕截图的右上角看到搜索框和按钮拒绝位于同一行.
http://i.imgur.com/fiurnYs.png
搜索框的HTML代码如下所示:
<div> <formrole="search"> <div> <input type="text"placeholder="Search" name="srch-term" id="srch-term"> <div> <buttontype="submit"><i> </i></button> </div> </div> </form> </div>
CSS代码如下所示:
https://raw.github.com/immenselyalive/dresswithease/master/bootstrap.css
解决方法
<div> <inputid="appendedInputButton" type="text"> <buttontype="button">Go!</button> </div>
http://getbootstrap.com/2.3.2/base-css.html#forms(搜索按钮而不是文本)
关于html – 使图像保持在同一位置的div内和html让图片在同一个水平线上的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于css – 文本更改时,div和文本框未在同一位置对齐、css – 缩放图像保持纵横比,然后在流体高度和宽度DIV内垂直和水平居中、HTML + CSS:如何强制div内容保持一行?、html – Bootstrap:如何让输入框和按钮保持在同一条线上?等相关内容,可以在本站寻找。
本文标签: