如何省略样式表以将样式应用到其他网页 [英] how to omit style sheet to apply style to other web page

查看:270
本文介绍了如何省略样式表以将样式应用到其他网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个消息中继器,像来自此引用的新消息通知对话 http://codepen.io/petebot/full/CpKzI 在这里我只是发现一个新样式表,给消息对话好看。但只有很少的限制,我只想要这个样式表名称的控制风格:

i 'm making one message repeater like new message notification dialogue from this reference http://codepen.io/petebot/full/CpKzI here i just found one new style sheet that gives nice look to message dialogue. but with little restriction i only want to this control style with this style sheet name :

<link id="Link2" href="../css/foundation.min.css" rel="stylesheet" type="text/css" target="_self"/>

我使用这个用户控制与web用户cotrol像这样:

so. i'm making this user control with web user cotrol like this :

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="notification.ascx.cs" Inherits="Staff_notification" %>
<link id="Link1" href="../css/notification.css" rel="stylesheet" type="text/css"/>
<link id="Link2" href="../css/foundation.min.css" rel="stylesheet" type="text/css" target="_self"/>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<div class="contain"><a href="#" class="notificationicon on" style="position:relative;text-decoration:none;">Messages&nbsp;<span class="noti_bubble1" runat="server" id="message_alert"><asp:Label ID="lbl_count_messages" runat="server"></asp:Label></span></a>
    <ul id="notificationMenu" class="notifications">
      <li class="titlebar">
        <span class="title">Messages</span>
        <span class="settings"><i class="icon-cog"></i>
        </span>
      </li>
      <div class="notifbox">
      <ul>
       <asp:Repeater ID="Repeater_Messages" runat="server">
       <ItemTemplate>
        <li class=" notif">
          <a href="Ticket.aspx?ticketid='<%#Eval("Ref_no")%>'&flag=0">
            <div class="imageblock">
             <asp:Image ID="userphoto" runat="server" CssClass="notifimage" ImageUrl = "../DisplayImage.ashx?userId='<%#Eval('UserId')%>"/>
            </div> 
            <div class="messageblock">
              <div class="message"><strong><%#Eval("Name")%></strong>:<br/><%#Eval("Message")%></div>
              <div class="messageinfo">
                <i class="icon-comment"></i><%# DataBinder.Eval(Container.DataItem,"CreatedDate","{0:ddd, dd MMMM yyyy}")%>&nbsp;at&nbsp;<%# DataBinder.Eval(Container.DataItem,"CreatedDate","{0:hh:mm tt}")%></div>
            </div>
          </a>
        </li>
       </ItemTemplate>
        </asp:Repeater>
        </ul>
      </div>
      <li class="seeall">
        <a href="javascript:void(0);" id="hpl_close">Close</a>
      </li>
    </ul>
  </div>

此样式表对所有母版页的影响。所以想省略这个样式表到其他页面。只有这个用户控件有这个。所以为此我创建web用户控件。但仍然会影响所有网页。

how ever this style sheet affect all master page. so want to omit this style sheet to other page. only this user control have this. so for this i create web user control. but still it's affect all web page.

这里我包括一个屏幕截图:

here i include one screen shot :

请帮助我...

推荐答案

我有一个很难理解你想要什么,但它听起来像你试图有一个样式表只有目标元素在DOM中,这不是样式表的工作原理。所以你的选择是给这个DOM元素一个ID,然后将所有的样式表的规则专门针对该ID,例如:

I'm having a really hard time understanding what you want, but it sounds like you're trying to have a style sheet only target one element in the DOM, which isn't how stylesheets work. So your option is to either give that DOM element an ID and then target all of the rules of the stylesheet specifically to that ID like so:

<div id="thisBox" class="notifbox">

#thisBox { styles go here }

看起来像你试图使用Foundation框架的一个你的设计。基础是一个完整的框架,是为网站建立,我想你最好滚动自己的风格。

However in this particular case it looks like you're trying to use the Foundation framework for one piece of your design. Foundation is an entire framework that is meant for websites to be built on, I think you're better off rolling your own styles.

这篇关于如何省略样式表以将样式应用到其他网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆