我有一个标准的CSS菜单,用UL和LI标签制作.我需要它们来横向覆盖整个页面(不是我的实际案例,但我会采取这种方式来简化这种情况).但是,项目是动态创建的,因此我无法将任何内容硬编码到LI项目或边距.
我已经看到使用JavaScript设置这些值的解决方案,但我真的很想避免它们.
最后,我看到了一个非常好的解决方案
#menu {
width: 100%;
/* etc */
}
#menu ul {
display: table;
}
#menu ul li {
display: table-cell;
}
Run Code Online (Sandbox Code Playgroud)
这将在大多数浏览器中创建所需的行为......除了IE.
有任何想法吗?
编辑:感谢您的回复.但是,由于生成项目的代码不是我的,我在创建它们时无法在不使用JavaScript的情况下设置内联样式.
当我尝试执行我的程序时,出现错误.我无法读取" ch"中的最后一个值:
int choi(char *Tvide[48])//permet de choisir la place selon les choix de l utilisateur
{
char fum, classe, pos;
printf("\n S.V.P choisissez votre Classe (A:1 ere classe )/(B: 2 eme classe): ");
classe = getche();
printf("\n Est ce que vous etes fumeur (O:fumeur)/(N:non fumeur):");
fum = getche();
printf("\n S.V.P vous preferez s''assoir pres de la fenetre ou du couloir(C:couloir )/(F:fenetre):");
pos=getche();
int Tfum[24] = {3,4,7,8,11,12,15,16,19,20,23,24,27,28,31,32,35,36,39,40,43,44,47,48};
int Tnfum[24] = {1,2,5,6,9,10,13,14,17,18,21,22,25,26,29,30,33,34,37,38,41,42,45,46};
int Tfen[24] = {1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48};
int Tcol[24] = {2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31,34,35,38,39,42,43,46,47};
int …Run Code Online (Sandbox Code Playgroud) 如果App.xaml与视图位于一个单独的程序集中,则此问题涉及Visual Studio(2008)WPF Designer显然无法处理位于App.xaml级别的资源的使用.
为了简化问题的解释,我创建了一个测试应用程序.此应用程序有两个程序集:View和Start.View程序集包含一个名为Window1的xaml窗口,Start程序集包含App.xaml文件.Start程序集中的App.xaml文件将其StartupUri设置为View程序集中的Window1.这些文件都没有代码隐藏(除了标准构造函数和InitializeComponent()调用).
此示例的代码如下:
App.xaml中:
<Application x:Class="Start.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="pack://application:,,,/View;component/Window1.xaml"
>
<Application.Resources>
<!-- Warning Text Style -->
<Style x:Key="WarningTextStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold" />
</Style>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
Window1.xaml:
<Window x:Class="View.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1"
Height="300"
Width="300"
>
<Grid>
<TextBlock Text="This is test text" Style="{StaticResource WarningTextStyle}" />
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
Window1.xaml文件包含一个引用应用程序级WarningTextStyle的TextBlock.此代码在运行时正常工作,因为Window正确查找了App级资源; 然而,在设计时,设计师抱怨它无法找到WarningTextStyle.
有没有人知道这个问题的清洁和可扩展的解决方案?
我对大型应用程序的标准方法是将我的应用级资源组织到资源字典文件中,然后在App.xaml中合并这些字典.要解决我上面描述的问题,我必须将这些资源字典合并到每个视图的资源中.这似乎非常低效,如果我以后添加另一个资源字典,那么我需要将新字典合并到每个视图中.
一个银弹解决方案将重新指导设计师找到应用级资源.合理的解决方法是将应用级资源字典合并到每个视图中,但仅限于设计时.在运行时,由于效率问题,我希望避免在每个视图中合并这些字典.
我尝试在视图的代码隐藏构造函数中合并每个视图上的字典,然后将该逻辑包装在检查DesignerProperties.GetIsInDesignMode()方法的if语句中; 但是,Visual Studio设计器不运行视图的构造函数 - 所以这种方法似乎是一个破产.
有没有人有更好的解决方案或解决方案?
非常简单,我有一个JS脚本,它包含在许多不同的站点上,需要传递参数.
如果可以通过URL传递它们将是有用的,例如:
<script type="text/javascript"
src="http://path.to/script.js?var1=something&var2=somethingelse"></script>
Run Code Online (Sandbox Code Playgroud)
是的,你仍然可以在一个单独的脚本标签中预先填充变量,但它是一个混乱,不太容易传递:
<script type="text/javascript">var1=something; var2=somethingelse</script>
<script type="text/javascript" src="http://path.to/script.js"></script>
Run Code Online (Sandbox Code Playgroud) 我正在尝试测量NSString的视觉大小,该大小考虑了我可以渲染的行数.但是,sizeWithFont没有考虑numberOfLines属性?因此,我的布局算法将所有内容都置于低于实际需要的位置.
_price = [[UILabel alloc] init];
_price.text = myPriceValue;
_price.lineBreakMode = UILineBreakModeWordWrap;
_price.numberOfLines = 3;
_price.backgroundColor = [UIColor clearColor];
_price.textColor = TTSTYLEVAR(colorPrice);
/// the follow code ignores numberOfLines and just tells me the size of the whole block.
// I'd like it to be aware of numberOfLines
//
CGSize priceSize = [_price.text sizeWithFont:_price.font
constrainedToSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
lineBreakMode:UILineBreakModeWordWrap];
Run Code Online (Sandbox Code Playgroud)
有谁知道如何使用iPhone SDK做到这一点?
我的服务生成一个新线程,并根据通常推荐的中断()方法java方法停止它.当我停止服务时,我在onDestroy()中停止线程.服务停止,并且到达中断代码.但是,很快就会从Runnable的开头重新开始.
public class DoScan extends Service {
public volatile Thread runner;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
startThread();
}
@Override
public void onDestroy() {
super.onDestroy();
android.util.Log.v("@@@@@@@@@@@@@@@@@@@@", "DoScan.onDestroy");
stopThread();
}
public synchronized void startThread(){
if(runner == null){
android.util.Log.v("@@@@@@@@@@@@@@@@@@@@", "DoScan.startthread");
runner = new Thread(new ScanningThread());
runner.start();
}
}
/* use a handler in a loop cycling through most of oncreate.
* the scanningthread does the work, then notifies the …Run Code Online (Sandbox Code Playgroud) 为什么打印垃圾而不是优雅地退出我的程序?我在BSD上以这种方式使用系统调用,我想知道在Linux中它需要什么才能使它工作.
int
main(int argc, char **argv)
{
__asm ("movq $1,%rax; movq $0,%rdi; syscall"); /* exit(0) ? */
return 0;
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我刚刚获得了Windows Server 2008 VPS,但我无法安装IIS7.
我在IIS中创建了一个新的网站,其中包含路径,IP地址和主机名(如"www.nameofsite.com"),然后单击"确定".当我浏览网站时,它会在浏览器中显示" http://www.nameofsite.com "并且......没有... IE无法显示此网页.
如果我在绑定中删除主机名并单击[浏览]它工作正常(它需要我到http://10.10.2.92 - 计算机的IP).因此,输入主机名会破坏网站.
关于我缺少的任何想法?服务我可能没有运行或我失踪的角色?
最初没有在VPS上安装任何服务器角色,所以我安装了IIS,DHCP,DNS和Application Server ...矫枉过正,但我不确定要安装什么.
有没有人知道如何使用本机Windows外观呈现MenuStrips,具体取决于用户使用的操作系统版本?
目前的渲染没有做到......
我目前正在使用第三方控件,可以使用MainMenu和ContextMenu而不是我正在寻找的,MenuStrip ...
如何找到“Jul 30 04:37”创建的内容并将它们移动到/tmp?有问题:
find . -ctime "0037043007" -exec mv {} /tmp +
Run Code Online (Sandbox Code Playgroud) c ×2
.net ×1
android ×1
app.xaml ×1
assembly ×1
binding ×1
css ×1
datetime ×1
find ×1
fonts ×1
function ×1
hostname ×1
iis ×1
iphone ×1
javascript ×1
linux ×1
list ×1
menustrip ×1
native ×1
objective-c ×1
resources ×1
spacing ×1
stylesheet ×1
uilabel ×1
unix ×1
variables ×1
wpf ×1
x86-64 ×1
xaml ×1