标签: margin

在 CSS 中使用负 (-) 像素作为边距是不好的做法吗?

.cpn .paymentPage .payment-fire .right {
  font-weight: bold;
  text-align: right;

  position: relative;
  margin-right: -27px;
  margin-bottom: 20px;
}
Run Code Online (Sandbox Code Playgroud)

margin-right: -27px 与 margin-left: 309px 是不好的做法吗?

css margin pixel

2
推荐指数
1
解决办法
2373
查看次数

Imagemagick 图像彼此相邻并具有适当的边距

我正在尝试创建一个具有透明背景的 png 文件,其中我将图像彼此相邻。

到目前为止我的命令是这样的:

convert --% -bordercolor none -background none -gravity center logo.png -border 5x5 ( img1.jpg img2.jpg img3.jpg -border 5x5 +append ) ( img4.jpg img5.jpg img6.jpg -border 5x5 +append ) -append -border 5x5 -resize 720x480 output.png
Run Code Online (Sandbox Code Playgroud)

它给我创造了这个形象

在此输入图像描述

我该如何更改命令才能使图像显示如下?

(我把背景设为灰色,以便可以看到白色文字,稍后背景将是透明的)

在此输入图像描述

我尝试了 Mark Setchells 建议,到目前为止该命令如下所示:

convert -background none -bordercolor none -gravity west \
C:\xampp\htdocs\app\storage\images\Img_1.jpg label:"1" +swap -append label:"text 1" -append -write miff:- +delete \
C:\xampp\htdocs\app\storage\images\Img_2.jpg label:"2" +swap -append label:"text 2" -append -write miff:- +delete \
C:\xampp\htdocs\app\storage\images\Img_3.jpg label:"3" +swap -append label:"text 3" …
Run Code Online (Sandbox Code Playgroud)

command image margin imagemagick

2
推荐指数
1
解决办法
2036
查看次数

Android 约束布局屏障和消失的边距

我有一个约束布局,如下所示:

A-B
--------- (barrier that refer to A and B bottom)
C (constraint_top_bottomOf barrier)
Run Code Online (Sandbox Code Playgroud)

这是代码:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".TypographyActivity"
    android:background="?attr/lightPrimary">

    <TextView
        android:id="@+id/textviewA"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/textviewB"
        app:layout_constraintTop_toTopOf="parent"
        android:text="Text A" />

    <TextView
        android:id="@+id/textviewB"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:layout_constraintStart_toEndOf="@id/textviewA"
        app:layout_constraintTop_toTopOf="parent"
        android:text="Text B" />

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="bottom"
        app:constraint_referenced_ids="textviewA, textviewB" />

    <TextView
        android:id="@+id/textviewC"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        app:layout_goneMarginTop="30dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/barrier"
        android:text="Text C" />

</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

即使 A 和 B 可见,textviewC 中的 goneMarginTop 也始终会被触发。

当 A 和 B 消失时,有没有办法将 …

android margin barrier android-constraintlayout

2
推荐指数
1
解决办法
5864
查看次数

调整 R 图的边距

我对调整 R 图的边距很感兴趣。我在 MacOS 上使用 R Studio,在 2013 intel CPU Macbook pro 上运行。

这是我用于生成绘图的数据:

spins <- runif(50, min = 0, max = 50)
Run Code Online (Sandbox Code Playgroud)

这是我用来生成绘图的代码:

hist(spins)
Run Code Online (Sandbox Code Playgroud)

这是控制台的结果:

> hist(spins)
Error in plot.new() : figure margins too large
Run Code Online (Sandbox Code Playgroud)

这是我的问题:

  1. 我如何找出该特定图的当前边距?
  2. 如何修改该特定图的边距?
  3. 有没有一种方法可以修改一般绘图的边距(例如,我可以使用一组代码来查找对象的边距,然后使用第二组代码来修改边距,以便它将显示在地块面积)?
  4. 是否有代码可以用来自动调整图的边距,以便每次都显示所需的图?

plot r margin

2
推荐指数
1
解决办法
5062
查看次数

CSS:将div向上移动其高度的一半?

在 CSS 中,我想将 div 向上移动其高度的一半,其中未明确指定其高度;它基于其内容的大小。这可以是top或margin-top。有谁知道如何做到这一点?如果我这样做,margin-top: 50%我知道 50% 将是父级宽度的 50%,而不是 div 高度的 50%。

html css margin

2
推荐指数
1
解决办法
741
查看次数

使用 Flutter 框架的容器小部件中的 margin 和 padding 有什么区别?




class app1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return (MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Hello ',
        home: Material(
          child: Container (
            alignment: Alignment.topCenter ,
            //padding: EdgeInsets.all (30 ),
            margin: EdgeInsets.all(30),
            child: Row(
              children: <Widget> [
                Text ( 'Hello There ' , style: TextStyle (fontSize: 30 ) ),
                ],
              ),
          ),
          ),



          )
    );

  }
}
Run Code Online (Sandbox Code Playgroud)

当我应用边距时我有一个文本小部件,然后应用填充相同的结果吗?那么有什么不同呢? 在此输入图像描述

margin padding flutter

2
推荐指数
1
解决办法
1万
查看次数

悬停时文本会移动

每次我将鼠标悬停在社交栏上并且它变大时,标题都会向下移动一些像素。我知道这是因为边距,但我不知道如何解决。CSS代码:

.socialbar {
  /* color: white; */
  background: pink; /* added by community for better display */
  display: flex;
  justify-content: center;
}

.socialbar img {
  width: 50px;
  height: auto;
  margin-top: 60px;
  margin-left: 16px;
  margin-right: 16px;
  transition: 0.3s;
}

.socialbar img:hover {
  width: 65px;
  height: auto;
  .headers {
    color: white;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    justify-content: center;
    margin-top: 200px;
  }
Run Code Online (Sandbox Code Playgroud)
<div class="socialbar">
  <a class="magic_eden" href=""><img src="https://i.imgur.com/57ypMsv.png"></a>
  <a class="discord" href=""><img src="https://i.imgur.com/YFeIsm8.png"></a>
  <a class="twitter" href=""><img src="https://i.imgur.com/ft9IJP1.png"></a>
</div>

<div class="headers">
  <span class="header_one">
      About
  </span> …
Run Code Online (Sandbox Code Playgroud)

html css image margin hover

2
推荐指数
1
解决办法
809
查看次数

如何单独设置StackPanels边距?

我可以在代码隐藏中设置stackpanel的边距,如下所示:

StackPanel sp2 = new StackPanel();
sp2.Margin = new System.Windows.Thickness(5);
Run Code Online (Sandbox Code Playgroud)

但是如何单独设置,这两个都不起作用:

伪代码:

sp2.Margin = new System.Windows.Thickness("5 0 0 0");
sp2.Margin.Left = new System.Windows.Thickness(5);
Run Code Online (Sandbox Code Playgroud)

c# wpf margin code-behind stackpanel

1
推荐指数
2
解决办法
8164
查看次数

LI margin不影响UL元素

如果我将margin-top放到第一个列表项(LI),那么margin在ul之外.

最后一项和margin-bottom也是一样的.但保证金左/保证金权利按预期运作.

为什么这样,是否可以修复?

请参阅:小提琴链接

干杯

html css list margin

1
推荐指数
1
解决办法
744
查看次数

在Android中,是否可以设置drawable的边距?

我想这样做,所以我可以在动画列表中更改边距.

这会使按钮更靠近或远离屏幕边缘.

xml animation android margin

1
推荐指数
1
解决办法
9119
查看次数