标签: alignment

CSS 浮动右下角

我有一些文本,周围漂浮着两个图像:

<!--This is obviously a simplified version, there are other styles needed for the images below-->
<div id="wrapper">
    <h2>Title</h2>
    
    <figure id="image1" style="float: left">
        <img />
        <figcaption>Caption</figcaption>
    </figure>
    
    <figure id="image2" style="float: right">
        <img />
        <figcaption>Caption</figcaption>
    </figure>
    
    <p>Lorem Ipsum</p>
</div>
Run Code Online (Sandbox Code Playgroud)

它是这样的:

实际CSS

我想要的是将第一张或第二张图像放置在段落的最底部。像这样的东西(用 Photoshop 制作):

我想要什么


我显然无法设置position: absolute,因为文本将不再漂浮在图像周围。

我无法将包装器显示为 a flexbox,因为它将元素对齐一行(或多行)并破坏所有内容:

使用弹性盒

我什至尝试将包装器显示为 atable并使用 将图形对齐到底部display: table-cell; vertical-align: bottom,但在这种情况下浮动不再起作用并且图形与中心对齐。


我设法得到的唯一部分解决方案是clear: both在图中使用:

清除:两者

这样做的问题是,当调整页面大小时,段落的高度会发生变化,图像不再位于其底部。


我能在 SO 上找到的唯一类似的答案是这个,但它在我的情况下不起作用,因为我事先不知道段落高度。

有什么想法让它发挥作用吗?提前致谢。

html css alignment vertical-alignment css-float

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

Kotlin Jetpack 在 LazyColum 内的 Column 中撰写中心文本

我是 jetpack compose 的新手,我真的很喜欢它。但遇到了一个问题:我想创建一张卡片,在其中,我想显示一个项目列表,项目之间有分隔线。我几乎能够实现它,这是我的代码:

Box(modifier = Modifier.background(Color(0xFFf4f4f4))
    .fillMaxSize()
    .padding(top = 20.dp)) {
    Card(
        modifier = Modifier
            .fillMaxWidth(),
        shape = RoundedCornerShape(20.dp),
        elevation = 5.dp
    ) {
        val colorNamesList = listOf("Red", "Green", "Blue", "Indigo")
        LazyColumn() {
            itemsIndexed(
                colorNamesList,
            ) { index, item ->
                Column(
                    modifier = Modifier
                        .background(
                            color = Color(0xFFf2f2f2),
                        )
                        .clickable {
                            println(item)
                        },
                    horizontalAlignment = Alignment.CenterHorizontally,//those 2 does nothing 
                    verticalArrangement = Arrangement.Center //when i change it nothing change
                ) {
                    println(item + index)
                    Text(
                        text = "Item at  $item", …
Run Code Online (Sandbox Code Playgroud)

android alignment centering kotlin android-jetpack-compose

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

TWinControl 组件不响应表单大小调整的问题

我有一个用 Delphi 10.4 编写的可视化控件。为了方便地关注问题,我仅创建了具有 Anchors 和 Align 属性的 TwinControl。我包括了 AutoSize 属性。问题是当该组件构建安装并放置在 TForm 上时,控件将不会响应表单大小调整。

该控件已将控件设置为锚定正确。我向表单添加了一个 TButton,并将其锚点设置为 akRight。按钮随着表单的拉伸而移动。我的控制没有。我可以提供这个小测试的完整源代码。也许有人以前见过这个。我以前曾在我的组件中使用过 TFrame,但发现存在一些显示问题,仅部分控件显示或根本不显示。我的客户没有留下深刻的印象。我会欣赏一些智慧。

这是来自 TWinControl 的代码

unit SampleControl;

    interface

    uses
      System.Classes, Vcl.Controls, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Buttons, Vcl.Dialogs,
      Vcl.Graphics,AdvGrid,vcl.Forms,System.SysUtils,StrUtils,Messages, EBS3DataUtils,
      EBSGridSetup,System.UITypes,WinApi.Windows,vcl.Grids,AdvObj,System.Variants;

    Type
      TSampleControl = class(TWinControl)
      private
        FAnchors: TAnchors;
        FAlign : TAlign;
        FAutoSize : Boolean;
        procedure InitializeComponents;
        procedure SetAnchors(const Value: TAnchors);
        procedure SetAlign(const Value: TAlign);
        procedure SetAutoSize(const Value: Boolean);
      Public
        procedure Resize; Override;
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;
      Published
        property Anchors: TAnchors read FAnchors write SetAnchors default …
Run Code Online (Sandbox Code Playgroud)

delphi anchor components vcl alignment

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

我如何让Vim像printf那样对齐?

我想让Vim对变量声明进行排序,如下所示:

NotifyNotification*    notification;
gboolean               success;
GError*                error = NULL;
Run Code Online (Sandbox Code Playgroud)

就像printf一样,我想在使用=对齐线时启用它,使其成为默认的对齐方法,有au FileType cpp可能吗?

vim printf alignment

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

如果窗口太小,请更改div对齐方式

我的主页上有一个居中的div。当我缩小窗口时,div从窗口的两侧伸出。我只希望它离开左侧的窗口。有什么办法吗?我想到如果窗口太小则更改对齐方式。

提前致谢!

编辑:我想从这里更改

<div style="margin: auto; width: 500px;"> centered div </div>
Run Code Online (Sandbox Code Playgroud)

类似于以下内容:

<div style="margin-left: 0px; width: 500px;"> not centered div </div>
Run Code Online (Sandbox Code Playgroud)

当窗口小于500px时显示全尺寸div。

css alignment

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

div内部的对齐问题

我在对齐div中的元素时遇到问题.

我想要这样的东西

|-----------------------------------------------|
|<P>   | <input type = text> | imagebutton here |
|here  |  here               |                  |
|-----------------------------------------------|
Run Code Online (Sandbox Code Playgroud)

但我得到类似的东西

|-----------------------------------------------|
|<P>   |                                        |
|here  |                                        |
|       <input type = text>  |                  |
|        here                |                  |
|                             imagebutton here  |
|-----------------------------------------------|
Run Code Online (Sandbox Code Playgroud)

所以有一些问题使得下一个元素div显示在当前元素下面,即如果我可以<input> 水平对齐<p>,我认为这将给出解决方案.

以下是我的尝试:

css部分

.imagewrapper{
    display: table-cell;
    background-color:yellow;
    margin-left: 70%;
    width: 25%;
    margin-bottom: 10%;
    height: 35%;
}
.textwrapper{
    display: table-cell;
    background-color:blue;
    margin-left: 30%;
    width: 40%;
    margin-bottom: 10%;
    height: 35%;
}

.msg_wrapper{
    display: …
Run Code Online (Sandbox Code Playgroud)

html css alignment

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

如何在不影响内部内容的情况下居中<div>?

我试图使这个<div>我必须集中在页面上,但是当我使用时align=center,div中的一些内容也会受到影响.有办法防止这种情况吗?

html alignment

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

如何在div中包装图像周围的文字?

我的网页组成有问题.下一个div显示我的文本和图像框,但文本不包装图像.我怎么解决这个问题?

HTML:

#boxx {
  padding: 20px 20px 20px 20px;
  position: fixed;
  left: 30%;
  border: 2px solid black;
  font: 2em Calibri;
  width: 500px;
  height: 1000px;
}

img {
  position: fixed;
  left: 30%;
  display: block;
  margin: 7px 7px 7px 7px;
}
Run Code Online (Sandbox Code Playgroud)

CSS:

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>?????</title>
  <link rel="stylesheet" href="design.css" />
</head>

<body>
  <h2 style="text-align: center">????? ???????? ?????</h2>
  <div id="boxx">????? ???????? ????? (17 [29] ?????? 1860 — 2 [15] ????? 1904) — ?????????? ??????????, ???????????????? ?????? ???????? ??????????. ?? …
Run Code Online (Sandbox Code Playgroud)

html css text alignment word-wrap

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

C++表格对齐 - cout和iomanip

我的程序中有一个小的对齐问题.

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    cout << setw(5) << "Sl. No:" << setw(15) << "Month" << setw(15) << "Name" << endl << endl;
    cout << setw(5) << 1 << setw(15) << "January" << setw(15) << "Abhilash" << endl;
    cout << setw(5) << 2 << setw(15) << "Februaury" << setw(15) << "Anandan" << endl;
    cout << setw(5) << 3 << setw(15) << "March" << setw(15) << "Abhilash" << endl;
    cout << setw(5) << 4 << …
Run Code Online (Sandbox Code Playgroud)

c++ cout alignment

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

如何修改Smith和Waterman perl脚本以加快速度?

我找到了这个perl脚本,但我有太多的序列需要分析.我想知道是否可以对其进行优化?我在它上面推出了NYTProf,看到部分"计算匹配分数","计算差距分数"和"选择最佳分数"需要花费大量时间.我是否必须修改数据结构?谢谢您的帮助.

perl脚本的参考:

    # Smith-Waterman  Algorithm
# from this website http://etutorials.org/Misc/blast/Part+II+Theory/Chapter+3.+Sequence+Alignment/3.2+Local+Alignment+Smith-Waterman/

# Smith-Waterman  Algorithm

# usage statement
die "usage: $0 <sequence 1> <sequence 2>\n" unless @ARGV == 2;

# get sequences from command line
my ($seq1, $seq2) = @ARGV;

# scoring scheme
my $MATCH    =  1; # +1 for letters that match
my $MISMATCH = -1; # -1 for letters that mismatch
my $GAP      = -1; # -1 for any gap

# initialization
my @matrix;
$matrix[0][0]{score}   = 0;
$matrix[0][0]{pointer} = "none"; …
Run Code Online (Sandbox Code Playgroud)

algorithm perl bioinformatics alignment

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