我有一个内部装有面板的图像,其中包含公司的联系信息。这两个元素在视口import matplotlib.pyplot as plt
import matplotlib as mpl
fig, ax = plt.subplots(figsize = (10,6))
ax.axis('equal')
plt.style.use('ggplot')
ax.grid(False)
xy = 0,0
circle = mpl.patches.Circle(xy, 160, lw = 3, edgecolor = 'black', color = 'b', alpha = 0.1, zorder = 5)
ax.add_patch(circle)
col_labels=['A','B','C','D','E']
row_labels=['diff','total']
table_vals=[['','','','',''],['','','','','']]
the_table = plt.table(cellText=table_vals,
colWidths = [0.05]*5,
rowLabels=row_labels,
colLabels=col_labels,
bbox = [1.1, 0.5, 0.35, 0.1])
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.8, box.height])
ax.autoscale()
plt.show()
上看起来很可怕。是否可以将面板推到视口< 768 px
上的图像下方?我试图通过Bootstrap类设置一个< 768 px
,但似乎没有做我想要的事情。
Demosite of the contactpage是在Bootstrap 3中制作的。
我试图删除所有与该问题无关的代码:
push-right
/* Track and trace */
.bs-calltoaction{
position: relative;
width:auto;
padding: 15px 25px;
border: 1px solid black;
margin-top: 10px;
margin-bottom: 10px;
border-radius: 5px;
}
.bs-calltoaction > .row{
display:table;
width: calc(100% + 30px);
}
.bs-calltoaction > .row > [class^="col-"],
.bs-calltoaction > .row > [class*=" col-"]{
float:none;
display:table-cell;
vertical-align:middle;
}
.cta-contents{
padding-top: 10px;
padding-bottom: 10px;
}
.cta-title{
margin: 0 auto 15px;
padding: 0;
}
.cta-desc{
padding: 0;
}
.cta-desc p:last-child{
margin-bottom: 0;
}
.cta-button{
padding-top: 10px;
padding-bottom: 10px;
}
@media (max-width: 991px){
.bs-calltoaction > .row{
display:block;
width: auto;
}
.bs-calltoaction > .row > [class^="col-"],
.bs-calltoaction > .row > [class*=" col-"]{
float:none;
display:block;
vertical-align:middle;
position: relative;
}
.cta-contents{
text-align: center;
}
}
.bs-calltoaction.bs-calltoaction-info{
color: #fff;
background-color: #5bc0de;
border-color: #46b8da;
}
.bs-calltoaction.bs-calltoaction-info .cta-button .btn {
border-color:#fff;
}
.abc {
position: relative;
}
.def {
position: absolute;
top: 10px;
right: 20px;
max-width: 300px;
}
@media screen and (max-width: 480px) {
.def {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 480px;
width: 95%;
height: 85%;
}
.panel.panel-default .panel-heading {
padding: 5px 15px;
}
.panel.panel-default .panel-body {
padding: 5px;
}
img.img-responsive {
height: 200px;
}
}
/* Grid css */
p.bottom-column-color {
font-size: 0.82em;
color: green;
}
.index-content a:hover {
color: black;
text-decoration: none;
}
.index-content .row {
margin-top: 20px;
}
.index-content a {
color: black;
}
.index-content .card {
background-color: #FFFFFF;
padding: 0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}
.index-content .card:hover {
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);
color: black;
}
.index-content .card img {
width: 100%;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.index-content .card h4 {
margin: 20px;
}
.index-content .card p {
margin: 20px;
opacity: 0.65;
}
.index-content .cta {
width: 235px;
-webkit-transition: background-color 1s, color 1s;
/* For Safari 3.1 to 6.0 */
transition: background-color 0.5s, color 0.5s;
min-height: 20px;
background-color: #4CAF50;
color: #ffffff;
border-radius: 4px;
text-align: center;
font-weight: lighter;
margin: 0px 20px 15px 20px;
padding: 5px 0px;
display: inline-block;
}
.index-content .cta:hover {
background-color: #dadada;
color: #002E5B;
}
/* Set width between block elements */
.small-padding.top {
padding-top:10px;
}
.small-padding.bottom {
padding-bottom:10px;
}
.small-padding.left {
padding-left:5px;
}
.small-padding.right {
padding-right:5px;
}
.row [class*="col-"] {
padding-left: 5px;
padding-right: 5px;
}
.margin_bottom {
margin-bottom: 10px;
}
.row [class*="col-"] {
padding-right: 5px;
padding-left: 5px;
}
.row {
margin-left: -5px;
margin-right: -5px;
}
.card-img-bottom {
color: #fff;
height: 20rem;
background: url(images/img1.jpg) center no-repeat;
background-size: cover;
}
.img-responsive {
height: 100%;
}
/* Set full width on columns */
@media (max-width: 768px) {
.img-responsive {
width: 100%;
}
.index-content .card img {
height: 100%
}
}
@media (max-width: 991px) {
h3 {
font-size: 1.2em;
}
}
/* GRID ELEMENTS MEDIA QUERIES */
@media (min-width: 768px) {
.card {
position: relative;
}
.card-content {
position: absolute;
bottom: 0;
width: 100%;
background: rgba(0, 0, 0, 0.5);
}
.card-content h4,
.card-content p {
color: white;
width: 100%;
float: left;
margin: 0 0 5px;
}
.card-content a {
float: right;
}
.index-content .card h4,
.index-content .card p {
padding: 15px 20px;
margin: 0;
}
.index-content .card p {
padding: 0 20px 15px;
margin: 0;
}
.card-content-textbox {
position: absolute;
top: 0;
left: 0;
background: rgba(255, 255, 255, 0.7);
/*right: 0;*//* top position on right*/
margin: 15px;
max-width: 300px;
height: 91%
}
}
答案 0 :(得分:1)
当然,请尝试以下代码:
@media (max-width: 993px) {
.def {
position: relative;
top: auto;
right: auto;
}
}
@media (max-width: 480px){
.def {
position: relative;
top: 167px;
right: auto;
}
}
答案 1 :(得分:0)
或者您可以将图像包装在一个列中,将面板包装在另一列中,例如:
<div class="container">
<div class="row">
<!-- Picture Column -->
<div class="abc">
<div class="col-lg-8 col-sm-12">
<img src="http://vouzalis.dk/Static/Cms/05ac4ebf-d478-49a7-8567-03257ece223b.jpg" class="img-responsive" />
</div>
<div class="col-lg-4 col-sm-12">
<div class="def" style="width:400px;">
<div class="panel panel-default">
<div class="panel-heading">
<h4>CompanyName A/S</h4>
</div>
<div class="panel-body">
<p>
<a href="#" target="_blank">Nyhåbsvej 16 - 18</a>
<br/> 8560 Kolind
</p>
<hr/>
<i class="fas fa-phone fa-2x"></i>
<a href="tel:+4586392900" style="padding-left:10px;font-size: 15px;">+ 45 86 39 29 00</a>
<br/>
<br/>
<i class="far fa-envelope fa-2x"></i>
<a href="mailto:info@CompanyName.dk" style="padding-left:10px;font-size: 15px;">info@CompanyName.dk</a>
<hr/>
<h5>Åbningstider</h5>
<p>Mandag - Torsdag: 8.00 - 16.00</p>
<p>Fredag: 8.00 - 15.00</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>