将代码从外部样式表移动到内部 [英] Moving code from external stylesheet to internal

查看:100
本文介绍了将代码从外部样式表移动到内部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的样式表main1.css中有这个条目:


#head {

宽度:310px;

身高:60px;

float:left;

display:block;

background-image:url( logo.jpg);

背景位置:左上角;

背景重复:不重复;

}


我试图将其移动到搜索引擎的网页代码中

优化目的,因此:


< div id = QUOT;头标志"风格= QUOT;宽度:310px;高度:115px; float:left;

background-position:left top; display:block;">< img src =" logo.jpg"

width =" 178"高度= QUOT; 59" alt ="驾驶教练保险 - 讲师

封面">< / div>


修订版中的徽标大约一英寸左右在右边

之前的位置。我做错了什么?


Stapes

解决方案

8月6日,14: 34,Stapes< steve.sta ... @ gmail.comwrote:


我的样式表main1.css中有这个条目:


我正在尝试将其移动到搜索引擎的网页代码中

优化目的,因此:



荒谬的毫无意义,所以不要试图这样做。


你在哪里找到了这个疯狂的巫毒头衔?


Stapes写道:


" Beauregard T. Shagnasty"写道:


>为什么?你认为人们会搜索..width:310px ?



否 - 我希望他们可以将alt文本添加到图像中。



替代文字应该在HTML< imgelement(它在哪里),并且

不是你的风格的一部分表格或内联样式。他们会找到它,

,无论你的造型方法如何。


....


是 - 我没有篡改原始样式表。所以我给了我的div一个不同的名字,因为我不再使用css

文件版本了。



用相同的

样式填充所有页面是不合适的。如果您使用一个

外部样式表,那么维护起来相当容易,而且下载

页面的人负担较轻。


> ..所以最好是你可以提供两个测试案例的URL,而不是依赖于这里可能不完整的代码片段。
其他可能是原因,例如正在使用的DOCTYPE。



网址 http://www.instructorcover.co.uk/index.aspx 。与
比较



这是一个新网站/页面吗?如果是这样,它应该使用严格的doctype,因为你没有从任何东西过渡,例如遗留页面。

http://www.w3.org/QA/2002/04/valid- dtd-list.html


你好像是在XHTML上,尽管大多数人会推荐使用

HTML 4.01 Strict。


您还需要删除HTML prolog

(<?xml version =" 1.0" encoding =" iso-8859-1"?> ;)

因为在DOCTYPE之前有任何东西会使IE6陷入怪癖

模式。

http://www.instructorcover.co.uk/about us.aspx,它使用CSS

文件,但标题相同。



" about us.aspx"未找到。两者都不是about_us.aspx,

" about-us.aspx"," aboutus.aspx"或者约。


-

-bts

-Motorcycles无视重力;汽车只是吮吸


8月6日,15:55,Beauregard T. Shagnasty

< a.nony.m .. 。@ example.invalidwrote:


Stapes写道:


" Beauregard T. Shagnasty"写道:


为什么?你认为人们会搜索..width:310px ?


否 - 我希望他们可以将alt文本添加到图像中。



替代文字应该在HTML< imgelement(它在哪里),并且

不是你的风格的一部分表格或内联样式。他们会找到它,

,无论你的造型方法如何。



肯定不行! - 这里的替代文字在哪里:


#head {

宽度:310px;

身高:60px;

float:left;

display:block;

background-image:url(logo.jpg);

background -position:left top;

background-repeat:no-repeat;

}


>

...


是的 - 我没有篡改原始样式表。所以我给了我的div一个不同的名字,因为我不再使用css

文件版本了。



用相同的

样式填充所有页面是不合适的。如果您使用一个

外部样式表,那么维护起来相当容易,而且下载

页面的人负担较轻。


..如果你能提供两个测试

案例的URL,而不是依赖于可能不完整的代码片段,那将是最好的这里。

其他可能是原因,例如正在使用的DOCTYPE。


网址为:http://www.instructorcover.co.uk/index.aspx。与
比较



这是一个新网站/页面吗?如果是这样,它应该使用严格的doctype,因为你没有从任何东西过渡,例如遗留页面。

http://www.w3.org/QA/2002/04/valid- dtd-list.html


你好像是在XHTML上,尽管大多数人会推荐使用

HTML 4.01 Strict。


您还需要删除HTML prolog

(<?xml version =" 1.0" encoding =" iso-8859-1"?> ;)

因为在DOCTYPE之前有任何东西会使IE6陷入怪癖

模式。

http://www.instructorcover.co.uk/aboutus.aspx ,它使用CSS

文件,但标题相同。



" about us.aspx"未找到。两者都不是about_us.aspx,

" about-us.aspx"," aboutus.aspx"或约。

http://www.instructorcover。 co.uk/about%20us.aspx


>

-

- bts

-Motorcycles无视重力;汽车只是吮吸



Hi
I have this entry in my stylesheet main1.css:

#head {
width: 310px;
height: 60px;
float: left;
display: block;
background-image: url(logo.jpg);
background-position: left top;
background-repeat: no-repeat;
}

I am trying to move it into the web page code for Search Engine
Optimisation purposes, thus:

<div id="head-logo" style="width:310px; height:115px; float:left;
background-position: left top; display:block;"><img src="logo.jpg"
width="178" height="59" alt="Driving Instructor Insurance - Instructor
Cover"></div>

The logo in the revised version comes out an inch or so to the right
of its previous position. What am I doing wrong?

Stapes

解决方案

On 6 Aug, 14:34, Stapes <steve.sta...@gmail.comwrote:

I have this entry in my stylesheet main1.css:

I am trying to move it into the web page code for Search Engine
Optimisation purposes, thus:

Ridiculously pointless, so stop trying to do that.

Just where did you find this crazy piece of wrong-headed voodoo?


Stapes wrote:

"Beauregard T. Shagnasty" wrote:

>Why? Do you think people search for .. "width:310px" ?


No - I am hoping they might pick up the alt text to the image.

The alt text should be in the HTML <imgelement (where it is), and
isn''t part of your style sheet, or inline style. They will find it,
regardless of your styling method.

....

Yes - I have not tampered with the original style sheet. So I have
given my div a different name because I am no longer using the css
file version.

It would be less than desirable to fill all your pages with the same
styles. There is a considerable ease to maintenance if you use one
external style sheet, and less of a burden to people downloading the
pages.

>..so it would be best if you could provide URLs to the two test
cases, instead of relying on possibly incomplete code snippets here.
Other things might be the reason, such as the DOCTYPE in use.


The URL is http://www.instructorcover.co.uk/index.aspx. Compare with

Is this a new site/page? If so, it should use a Strict doctype, as you
aren''t Transitioning from anything, such as a legacy page.

http://www.w3.org/QA/2002/04/valid-dtd-list.html

You seem to be on the XHTML bandwagon, though most will recommend using
HTML 4.01 Strict.

You will also want to drop the HTML prolog
(<?xml version="1.0" encoding="iso-8859-1"?>)
as having anything preceding the DOCTYPE will throw IE6 into quirks
mode.

http://www.instructorcover.co.uk/about us.aspx, which uses the CSS
file, but has the same heading.

"about us.aspx" not found. Neither was "about_us.aspx",
"about-us.aspx", "aboutus.aspx" or "about".

--
-bts
-Motorcycles defy gravity; cars just suck


On 6 Aug, 15:55, "Beauregard T. Shagnasty"
<a.nony.m...@example.invalidwrote:

Stapes wrote:

"Beauregard T. Shagnasty" wrote:

Why? Do you think people search for .. "width:310px" ?

No - I am hoping they might pick up the alt text to the image.


The alt text should be in the HTML <imgelement (where it is), and
isn''t part of your style sheet, or inline style. They will find it,
regardless of your styling method.

Surely not! - where is the alt text in this:

#head {
width: 310px;
height: 60px;
float: left;
display: block;
background-image: url(logo.jpg);
background-position: left top;
background-repeat: no-repeat;
}

>
...

Yes - I have not tampered with the original style sheet. So I have
given my div a different name because I am no longer using the css
file version.


It would be less than desirable to fill all your pages with the same
styles. There is a considerable ease to maintenance if you use one
external style sheet, and less of a burden to people downloading the
pages.

..so it would be best if you could provide URLs to the two test
cases, instead of relying on possibly incomplete code snippets here.
Other things might be the reason, such as the DOCTYPE in use.

The URL ishttp://www.instructorcover.co.uk/index.aspx. Compare with


Is this a new site/page? If so, it should use a Strict doctype, as you
aren''t Transitioning from anything, such as a legacy page.

http://www.w3.org/QA/2002/04/valid-dtd-list.html

You seem to be on the XHTML bandwagon, though most will recommend using
HTML 4.01 Strict.

You will also want to drop the HTML prolog
(<?xml version="1.0" encoding="iso-8859-1"?>)
as having anything preceding the DOCTYPE will throw IE6 into quirks
mode.

http://www.instructorcover.co.uk/aboutus.aspx, which uses the CSS
file, but has the same heading.


"about us.aspx" not found. Neither was "about_us.aspx",
"about-us.aspx", "aboutus.aspx" or "about".

http://www.instructorcover.co.uk/about%20us.aspx

>
--
-bts
-Motorcycles defy gravity; cars just suck



这篇关于将代码从外部样式表移动到内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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