我发现这个 css 代码可以让我保持 div 的长宽比。
.container {
width: 100%;
height: 100%;
background-color: red;
position: absolute;
}
.wrapper {
width: 100%;
/* whatever width you want */
display: inline-block;
position: relative;
top: 50%;
transform: translate(0%, -50%);
}
.wrapper:after {
padding-top: 56.25%;
/* 16:9 ratio */
display: block;
content: '';
}
.main {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
/* fill parent */
background-color: deepskyblue;
/* let's see it! */
color: white;
}
Run Code Online (Sandbox Code Playgroud)
请参阅此 JSFiddle 示例:https ://jsfiddle.net/1uyo07tg/3/ …
我在as3中设计了一个游戏自助服务终端应用程序我在Windows 7中使用它在索尼vaio l pc(如hp的touchsmarts)上该应用程序不需要任何多点触控手势(只有单击触摸点击和拖动)所以我正在使用鼠标事件
一切都很好(包括鼠标点击和移动事件),除了单次触摸屏幕(没有移动)不会触发鼠标.它仅在手指轻微移动后才会被触发
在应用程序外部,在我的桌面上,我看到小窗口7光标立即跳到手指放置的位置,这意味着这个问题不是硬件或Windows问题,而是内部闪存应用程序如何接收"翻译"触摸 - 来自操作系统的鼠标事件.
例如,在Windows Solitaire游戏中,对屏幕的简单触摸会立即突出显示触摸的卡片.在我的应用程序中,只有当我触摸它并同时轻轻移动我的手指时,按钮才会变为向下状态(单击事件 - 向下和向上 - 被触发正常)
MOUSE_DOWN事件不应该像新的touchevent类中的TOUCH_BEGIN那样触发吗?
有任何想法吗?
我根本不是一个Windows开发人员(我做AS3的东西),但我在visual c#2010中编写了这个C#控制台应用程序,以便测试一些东西.应用程序应该打开一个窗口并调整大小并重新定位.
我打开一个空白的Chrome窗口(标题为"无标题"),但控制窗口的功能不起作用(即使调试器停在它们上 - 这意味着应用确实找到了正确的窗口).
任何想法为什么?
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool MoveWindow(IntPtr hwnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
private static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
static void Main(string[] args)
{
Process[] processlist = Process.GetProcesses();
foreach (Process proc in processlist)
{
if (!String.IsNullOrEmpty(proc.MainWindowTitle) && proc.MainWindowTitle == "Untitled")
{
ShowWindow(proc.Handle, 3);
MoveWindow(proc.Handle, 0, 0, …Run Code Online (Sandbox Code Playgroud)