douxun4860 2013-05-18 19:00
浏览 29
已采纳

我的网页有三个内部样式表,没有正确的脚本标记吗?

I am having a three internal style sheets and one external style sheet in my web page. Simplified output looks like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Some title</title> 

<!--This is a NORMAL external stlesheet-->

<link rel="stylesheet" type="text/css" media="all" href="http://localhost/wp-content/themes/My_Theme/css/style.css" />

<!--Will display SINGLE COLUMN instead TWO COLUMNS if no JS enabled-->  
<noscript>
<style type="text/css">
.col1{

width:100%;
margin:0px;
display:block;
position:relative;      
}
</style>
</noscript> 

<!--This is MY DYNAMIC stylesheet generated by SOME PHP-->
<style type="text/css">

#blogwrapper{   
width: 530px;
margin-left:6px;    
}
</style>

<!--This is also DYNAMIC stylesheet BUT generated WORDPRESS PHP-->
<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #1e73be; }
</style>
</head>
</body>
</html>

My page passes HTML and CSS Validation ,but I am still having doubts is it a right way for implementing my CSS this way.

So my question is: am I doing this right or not (because I am developing a Wordpress theme and I want to make it publicly available , so don't want my theme being rejected by Wordpress Review Team ) ?

  • 写回答

1条回答 默认 最新

  • douke7431 2013-05-18 19:05
    关注

    writing inline style sheets on the HTML/PHP page is always unwelcome even if it works. It has following disadvantages:

    1. The page code gets lengthy

    2. The style sheet becomes available only for the specific page.

    3. Its tedious to change the style sheet for designer in future purpose.

    Therefore, even if it works, please remove the inline style sheets and move them to separate CSS files. Same for JavaScript file.

    Thanks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 深度学习残差模块模型
  • ¥20 两个不同Subnet的点对点连接
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)