当我将它上传到Ruby on Rails应用程序时,我需要知道图像的平均颜色.是否可以在HEX或RGB中获得平均颜色值,以便稍后在将要显示此图像的视图中使用此颜色?
就像是:
img = Magick::Image.read(path).first
hexVal = img.getHexValue
Run Code Online (Sandbox Code Playgroud) 我试图在一个方形div中放置一些文本.唯一的问题是它会将文本的div转移很多.有谁知道我怎么能让div回到原来的位置?
这是html:
<div id="squarecontainer">
<div id="square1">
<p>Easy to Manage</p>
</div>
<div id="square2">
</div>
<div id="square3">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是css:
#squarecontainer{
text-align: center;
}
#square1{
display: inline-block;
position: relative;
margin-right: 100px;
height: 310px;
width: 310px;
margin-top: 72px;
background-color: #fff;
}
#square2{
display: inline-block;
position: relative;
height: 310px;
width: 310px;
margin-top: 72px;
background-color: #fff;
}
#square3{
display: inline-block;
position: relative;
margin-left: 100px;
height: 310px;
width: 310px;
margin-top: 72px;
background-color: #fff;
}
Run Code Online (Sandbox Code Playgroud)
#square1 当我添加"易于管理"文本时,div正在向下移动.