【问题标题】:Width 100% and height 100% not working in chrome宽度 100% 和高度 100% 在 chrome 中不起作用
【发布时间】:2019-03-08 23:11:04
【问题描述】:

我不太了解数组,我需要创建一个“歌曲数组”类型的变量,然后将其初始化为一个新数组,以便它可以存储对歌曲的 4 个引用。在调用 InputSOngDetails() 方法并将返回值存储在该方法中时,我将如何创建一个循环运行足够多次来填充数组?

namespace Songs

{ 课堂节目 { 静态 void Main(string[] args) {

        InputSongDetails();
    }


    static Song InputSongDetails()
    {
        Console.WriteLine("What is the name of your song");
        string name = Console.ReadLine();

        Console.WriteLine("What is the artists name");
        string artist = Console.ReadLine();

        int records;
        Console.WriteLine("How many records did it sell");
        while (!int.TryParse(Console.ReadLine(), out records) || records < 0)
        {
            Console.WriteLine("That is not valid please enter a number");
        }
        return new Song(name, artist, records);
    }
}

}

如果需要,这是我的歌曲课程

命名空间歌曲 { 班歌 { 字符串名称; 弦乐艺术家; int 副本已售出;

    public Song(string name, string artist, int copiesSold)
    {
        this.name = name;
        this.artist = artist;
        this.copiesSold = copiesSold;
    }

    public Song()
    {
    }

    public string GetArtist()
    {
        return artist;
    }

    public string GetDetails()
    {
        return $"Name: {name} Artist: {artist} Copies Sold: {copiesSold},";
    }

    public string GetCertification()
    {
        if (copiesSold<200000)
        {
            return null;
        }
        if (copiesSold<400000)
        {
            return "Silver";
        }
        if (copiesSold<600000)
        {
            return "gold";
        }
        return "Platinum";  
    }
}

}

【问题讨论】:

  • 如果您的目标是让每个视频拉伸以填充视口,您可以使用 vh 和 vw 单位。 1vh 实际上是屏幕高度的 1%。 1vw = 屏幕宽度的 1%。
  • 也许尝试使用最大宽度/最大高度值结合宽度/高度 = 100%。这将导致 iframe 将其容器填充到定义的最大值。它还可以让它们缩小到更小的屏幕。

标签: c# arrays


【解决方案1】:

将宽度/高度声明为 100%,但使用 max-width / max-height 将其限制为所需的尺寸。

<iframe style="width: 100%; height: 100%; max-width: 700px; max-height: 400px"></iframe>

【讨论】:

    猜你喜欢
    • 2016-08-09
    • 2015-02-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-28
    • 2011-01-14
    • 2013-11-09
    • 2013-12-06
    相关资源
    最近更新 更多