开发者

css stylesheets

i need to implement two different stylesheets in a single master page. one style sheet is designed specifically for the project, and works fine. but when i add the second style sheet to it, which is used for some other project, all the web content forms look weird. what is the best开发者_如何学运维 way of implementing those two stylesheets in the project?


The only thing you have to take into account is that no two styles in these files override each other. Then you can include any number of style sheets.


What is 'weird'... How do they look? Like one of the StyleSheets is not at all applied or like they both override themselves?

There's a neat thing about styling WebControls, as you should not rely on the "id" you set them to as a css-reference, as at runtime, the IDs of any Controls in an ASP-Page are reassigned.

So you should try to avoid using the same ID for CodeBehind-Access on a Control and for styling the same control.

Try using classes that are not redundant in the two stylesheets. Probably one of the stylesheets has a reset of all other styles in it, like

* {
 padding: 0;
 margin: 0;
}

that overrides the other stylesheet's rules.

It's pretty hard to help you with so few information...


Don't define same styles classes in two stylesheet files and also don't define styles for html elements like body, div, tr...etc in two files.

E.G.

stylesheet1.css:

body
{
background-color:#F1F1F1;
padding:10px;
}
.search
{
background-color:#0000FF;
margin:3px;
}

stylesheet2.css:

body
{
background-color:#FFFFFF;
padding:15px;
font-size:12px;
}
.search
{
background-color:#000000;
margin:3px;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜