HTML / CSS内容缩放(HTML/CSS content scaling)
我已经开始开发一个网页,只是玩游戏,我注意到了一个问题。 我在我的一半屏幕上使用我的实时网站进行编码,另一方面使用我的编辑器进行编码。 在我完全扩展我的网络浏览器并注意到我的网站的一部分正在调整我想要的方式之前,一切都很顺利。 遗憾的是我的网站不在线,但是我确实有一个代码链接: http : //pastebin.com/yeWzfsBW
从理论上讲,当我调整窗口大小时,图像(徽标)不会缩小,无论如何都会保持相同的大小。 我试图使用百分比而不是像素宽度/高度,但似乎没有效果。 我会尝试弹出这个直播,这样你就可以看到我的意思了。
全尺寸浏览器: http : //imageshack.us/photo/my-images/585/fullsizen.jpg/
窗口模式:imageshack.us/photo/my-images/42/resizedkl.jpg/(请输入http://我无法链接此帖子中的两个以上链接)希望你能看到我的意思,我想要扩展徽标,就像#info css部分一样。
谢谢!
I have begun developing a webpage, just playing around, and I noticed an issue. I code with my live site on one half of my screen, with my editor on the other. It was all going fine until I extended my web browser fully and noticed that only part of my site was re sizing how I wanted it too. Sadly my site is not live, however I do have a link to the code: http://pastebin.com/yeWzfsBW
In theory, the image (logo) doesn't scale down when I resize the window, it stays the same size no matter what. I attempted to use percentages instead of pixel width/heights however it seemed to have no effect. I will try to pop this live so you can see what I mean exactly.
Fullsized browser: http://imageshack.us/photo/my-images/585/fullsizen.jpg/
windowed mode: imageshack.us/photo/my-images/42/resizedkl.jpg/ (please put in the http:// I couldn't link more then two links in this post)Hopefully you can see what I mean, i'd like the logo to scale, like the #info css section.
Thanks!
原文:https://stackoverflow.com/questions/17069141
最满意答案
我可以重现这个(在调试和发布中), 当通过IDE执行时,通过下面的“Debug”=>“启用Visual Studio主机进程”选项启用。 在命令行,它将打印“hello”,在那里 - 通过IDE它将打印“世界”。 看起来IDE正在对属性进行一些不同的反思。
这不是预期的行为,您不应该依赖此行为。 如果您想要执行某些特定代码:显式调用所需代码。 要获得可预测的行为,请禁用Debug“=>”启用Visual Studio托管过程“选项。
using System; public class MyTestAttribute : Attribute { public MyTestAttribute() { Program.text = "world"; } } class Program { public static string text = "hello"; [MyTest] static void Main() { Console.WriteLine(text); Console.ReadKey(); } }
I can reproduce this (in both debug and release), when executed via the IDE with the "Debug" => "Enable the Visual Studio hosting process" option enabled, via the below. At the command-line it will print "hello", where-as via the IDE it will print "world". It looks like the IDE is doing some different reflection on the attributes.
This is not expected behaviour, and you should not rely on this behaviour. If you want some particular code to execute: invoke the desired code explicitly. To get predictable behaviour, disable the Debug" => "Enable the Visual Studio hosting process" option.
using System; public class MyTestAttribute : Attribute { public MyTestAttribute() { Program.text = "world"; } } class Program { public static string text = "hello"; [MyTest] static void Main() { Console.WriteLine(text); Console.ReadKey(); } }
相关问答
更多-
装饰方法(Decorating a method)[2023-06-19]
装饰器方法不起作用,因为在构造类时调用装饰器,而不是在构造实例时调用。 当你说 class Foo(object): @some_decorator def bar(self, *args, **kwargs): # etc etc 然后在构造类Foo时调用some_decorator ,它将传递一个未绑定的方法,而不是实例的绑定方法。 这就是为什么self没有通过。 另一方面,第二种方法可以工作,只要您只使用装饰器创建每个类的一个对象, 并且如果您有点聪明。 如果你定义如上所述,然后定义 ... -
在对象构造函数之前调用GCC __attribute __((构造函数))(GCC __attribute__((constructor)) is called before object constructor)[2022-08-12]
__attribute__((constructor))是一个编译器扩展,所以你离开了标准C ++的领域。 看起来GCC的构造函数在全局初始化之前运行。 修复它的方法是使用另一个vanilla C ++构造,例如一个全局对象,它的初始化通过在与其他全局相同的TU中定义它来正确排序: Ala a; static void initialize_shared_library() { printf("initializing shared library\n"); printf("a.i=%d\ ... -
否执行main()方法jvm不构造类的Object,这就是为什么main()方法是static 它正在执行 ConstructorExample ce = new ConstructorExample(); 确认以下评论 \\ConstructorExample ce = new ConstructorExample(); No to execute main() method jvm doesn't construct Object of class, thats why main() method i ...
-
在JSF 2.1.16中的save方法之前调用ViewScoped构造函数(ViewScoped Constructor being called before save method in JSF 2.1.16)[2023-02-28]
这个问题已在Mojarra JSF 2.1.17中得到解决,经过试用和测试。 可能是Mojarra JSF 2.1.16和Tomcat 6的问题 。 但是,我没有找到该版本的任何已知问题 。 This issue has been solved in Mojarra JSF 2.1.17, tried and tested. Could be a problem with Mojarra JSF 2.1.16 and Tomcat 6. However, I haven't found any known ... -
在Release配置中使用IMP调用时,方法参数为nil(Method parameters are nil when called using IMP in Release configuration)[2023-10-05]
从未尝试将IMP实例转换为具有可变参数的函数,我无法确定它将如何工作(例如,它可能涉及解析va_list ),但是因为你知道你有一个且只有一个一个参数,我认为你应该能够通过在将IMP实例转换为函数指针时消除使用可变参数来解决这个特定问题: - (void) delegateCall:(SEL)sel withObject:(id)object { for (id delegate in self.delegates) { if ([delegate respondsToSelecto ... -
编号。构造函数用于创建对象,您无法在现有对象上再次调用它们。 对象从一生开始,终生(最多)一次。 你想要做的就像出生两次,这听起来很混乱。 No. Constructors are used to create an object, you cannot call them again on an existing object. Objects begin their lifetime once, and end their lifetime (at most) once. What you are tr ...
-
我可以重现这个(在调试和发布中), 当通过IDE执行时,通过下面的“Debug”=>“启用Visual Studio主机进程”选项启用。 在命令行,它将打印“hello”,在那里 - 通过IDE它将打印“世界”。 看起来IDE正在对属性进行一些不同的反思。 这不是预期的行为,您不应该依赖此行为。 如果您想要执行某些特定代码:显式调用所需代码。 要获得可预测的行为,请禁用Debug“=>”启用Visual Studio托管过程“选项。 using System; public class MyTestAttr ...
-
在发布版本中,JIT编译器毫无疑问地内联方法调用 - 这就是行号不同的原因。 In the release build, the JIT compiler is no doubt inlining the method call - that's why the line number is different.
-
main是一个静态方法,是程序的入口点,并且在程序启动时调用一次 (除非您明确调用它),而不是每个对象的初始化。 main is a static method, the entry point for the program, and is called once (unless you explicitly call it), when the program starts, not for each object initialization.
-
正如Marc所说,如果我是你,我会在Main明确地做到这一点。 您可以使用Type.TypeInitializer属性显式调用类型初始值Type.TypeInitializer并调用它。 但是,这将导致它再次运行, 即使它已经运行 ,可能会产生意外的结果。 我个人会完全将该代码移出静态初始化程序。 这是配置代码 - 为什么不只是让它成为一个可以显式调用的静态方法? 我甚至不确定我是否在属性类本身中拥有它,但至少显式调用: CascadeOnUpdateAttribute.ConfigureDb4oFacto ...