我继承了使用Google GSNewsBar的网站。该向导将创建包含链接样式表的代码。
在每个浏览器上但IE8的内容显示正确(即使是IE7!) -
但是在IE8中,搜索词列表没有包装。我在代码中添加了一个覆盖div宽度的本地样式,在IE8中使用开发人员工具,我可以看到它正确设置了宽度(下面屏幕截图中的蓝色轮廓)。但文字没有包装。有人可以帮我从这里出去吗?我已经尝试将word-wrap:break-word添加到覆盖样式,它会强制它换行,但它会在单词中间而不是在单词之间中断。
以下是整段代码,包括覆盖样式:
<!-- Begin News Bar Wizard Generated Code++ -->
<!--
// Created with a Google AJAX Search Wizard
//http://www.google.com/uds/solutions/wizards/newsbar.html
-->
<!--
// The Following div element will end up holding the actual newsbar.
// You can place this anywhere on your page.
-->
<div id="newsBar-bar" style="padding-left:10px">
<span style="color:#a5a599">Loading Google News Results</span>
</div>
<!-- Ajax Search Api and Stylesheet
// Note: If you are already using the AJAX Search API, then do not include it
// or its stylesheet again
-->
<script src="http://www.google.com/uds/api?file=uds.js&v=1.0&source=uds-nbw"
type="text/javascript"></script>
<style type="text/css">
@import url("http://www.google.com/uds/css/gsearch.css");
</style>
<!-- News Bar Code and Stylesheet -->
<script type="text/javascript">
window._uds_nbw_donotrepair = true;
</script>
<script src="http://www.google.com/uds/solutions/newsbar/gsnewsbar.js?mode=new"
type="text/javascript"></script>
<style type="text/css">
@import url("http://www.google.com/uds/solutions/newsbar/gsnewsbar.css");
</style>
<style type="text/css">
.gs-result .gs-title * { color: #243c60; }
.titleBox_gsnb { line-height: 1.1; padding-bottom: .25em; }
.statusBoxRoot_gsnb {
width: 300px;
/*word-wrap: normal;*/
}
</style>
<script type="text/javascript">
function LoadNewsBar() {
var newsBar;
var options = {
largeResultSet : true,
title : "Google News Results",
horizontal : false,
linkTarget : GSearch.LINK_TARGET_BLANK,
resultStyle : GSnewsBar.RESULT_STYLE_COMPRESSED,
autoExecuteList : {
executeList : [<?php print $google_news_string; ?>]
}
}
newsBar = new GSnewsBar(document.getElementById("newsBar-bar"), options);
}
// arrange for this function to be called during body.onload
// event processing
GSearch.setOnLoadCallback(LoadNewsBar);
</script>
<!-- ++End News Bar Wizard Generated Code++ -->
更新 - 根据下面的评论,搜索字词在完全空白的,没有样式的页面中使用时会正确包装,因此必须在页面上的现有样式中存在某些内容这个。以下是Chrome元素检查器中所选元素(statusBoxRoot_gsnb)的Computed Styles内容(非常长,很抱歉):
-webkit-animation-delay: 0s;
-webkit-animation-direction: normal;
-webkit-animation-duration: 0s;
-webkit-animation-fill-mode: none;
-webkit-animation-iteration-count: 1;
-webkit-animation-name: none;
-webkit-animation-play-state: running;
-webkit-animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
-webkit-appearance: none;
-webkit-backface-visibility: visible;
-webkit-background-clip: border-box;
-webkit-background-composite: source-over;
-webkit-background-origin: padding-box;
-webkit-background-size: auto auto;
-webkit-border-fit: border;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-image: none;
-webkit-border-vertical-spacing: 0px;
-webkit-box-align: stretch;
-webkit-box-direction: normal;
-webkit-box-flex: 0;
-webkit-box-flex-group: 1;
-webkit-box-lines: single;
-webkit-box-ordinal-group: 1;
-webkit-box-orient: horizontal;
-webkit-box-pack: start;
-webkit-box-reflect: none;
-webkit-box-shadow: none;
-webkit-color-correction: default;
-webkit-column-break-after: auto;
-webkit-column-break-before: auto;
-webkit-column-break-inside: auto;
-webkit-column-count: auto;
-webkit-column-gap: normal;
-webkit-column-rule-color: #383833;
-webkit-column-rule-style: none;
-webkit-column-rule-width: 0px;
-webkit-column-span: 1;
-webkit-column-width: auto;
-webkit-font-smoothing: auto;
-webkit-highlight: none;
-webkit-hyphenate-character: auto;
-webkit-hyphenate-limit-after: auto;
-webkit-hyphenate-limit-before: auto;
-webkit-hyphens: manual;
-webkit-line-break: normal;
-webkit-line-clamp: none;
-webkit-locale: auto;
-webkit-margin-after-collapse: collapse;
-webkit-margin-before-collapse: collapse;
-webkit-marquee-direction: auto;
-webkit-marquee-increment: 6px;
-webkit-marquee-repetition: infinite;
-webkit-marquee-style: scroll;
-webkit-mask-attachment: scroll;
-webkit-mask-box-image: none;
-webkit-mask-clip: border-box;
-webkit-mask-composite: source-over;
-webkit-mask-image: none;
-webkit-mask-origin: border-box;
-webkit-mask-position: 0% 0%;
-webkit-mask-repeat: repeat;
-webkit-mask-size: auto auto;
-webkit-nbsp-mode: normal;
-webkit-perspective: none;
-webkit-perspective-origin: 150px 31px;
-webkit-rtl-ordering: logical;
-webkit-svg-shadow: none;
-webkit-text-combine: none;
-webkit-text-decorations-in-effect: none;
-webkit-text-emphasis-color: #383833;
-webkit-text-emphasis-position: over;
-webkit-text-emphasis-style: none;
-webkit-text-fill-color: #383833;
-webkit-text-security: none;
-webkit-text-stroke-color: #383833;
-webkit-text-stroke-width: 0px;
-webkit-transform: none;
-webkit-transform-origin: 150px 31px;
-webkit-transform-style: flat;
-webkit-transition-delay: 0s;
-webkit-transition-duration: 0s;
-webkit-transition-property: all;
-webkit-transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
-webkit-user-drag: auto;
-webkit-user-modify: read-only;
-webkit-user-select: text;
-webkit-writing-mode: horizontal-tb;
alignment-baseline: auto;
background-attachment: scroll;
background-clip: border-box;
background-color: transparent;
background-image: none;
background-origin: padding-box;
background-position: 0% 0%;
background-repeat: repeat;
background-size: auto auto;
baseline-shift: baseline;
border-bottom-color: #383833;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
border-bottom-style: none;
border-bottom-width: 0px;
border-collapse: separate;
border-left-color: #383833;
border-left-style: none;
border-left-width: 0px;
border-right-color: #383833;
border-right-style: none;
border-right-width: 0px;
border-top-color: #383833;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
border-top-style: none;
border-top-width: 0px;
bottom: auto;
box-shadow: none;
box-sizing: content-box;
caption-side: top;
clear: none;
clip: auto;
clip-path: none;
clip-rule: nonzero;
color: #383833;
color-interpolation: srgb;
color-interpolation-filters: linearrgb;
color-rendering: auto;
cursor: auto;
direction: ltr;
display: block;
dominant-baseline: auto;
empty-cells: show;
fill: black;
fill-opacity: 1;
fill-rule: nonzero;
filter: none;
float: none;
flood-color: black;
flood-opacity: 1;
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
font-style: normal;
font-variant: normal;
font-weight: normal;
glyph-orientation-horizontal: 0deg;
glyph-orientation-vertical: auto;
height: 62px;
image-rendering: auto;
kerning: 0;
left: auto;
letter-spacing: normal;
lighting-color: white;
line-height: 18px;
list-style-image: none;
list-style-position: outside;
list-style-type: disc;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
marker-end: none;
marker-mid: none;
marker-start: none;
mask: none;
max-height: none;
max-width: none;
min-height: 0px;
min-width: 0px;
opacity: 1;
orphans: 2;
outline-color: #383833;
outline-style: none;
outline-width: 0px;
overflow-x: visible;
overflow-y: visible;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
page-break-after: auto;
page-break-before: auto;
page-break-inside: auto;
pointer-events: auto;
position: static;
resize: none;
right: auto;
shape-rendering: auto;
speak: normal;
stop-color: black;
stop-opacity: 1;
stroke: none;
stroke-dasharray: none;
stroke-dashoffset: 0;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-opacity: 1;
stroke-width: 1;
table-layout: auto;
text-align: left;
text-anchor: start;
text-decoration: none;
text-indent: 0px;
text-overflow: clip;
text-rendering: auto;
text-shadow: none;
text-transform: none;
top: auto;
unicode-bidi: normal;
vector-effect: none;
vertical-align: baseline;
visibility: visible;
white-space: normal;
widows: 2;
width: 300px;
word-break: normal;
word-spacing: 0px;
word-wrap: normal;
writing-mode: lr-tb;
z-index: auto;
zoom: 1;
我找不到从IE8的开发人员工具中复制/粘贴的简单方法,所以这里是应用于所选元素(statusBoxRoot_gsnb)的样式的屏幕截图。我希望有人会在前几行看到明显的东西,所以你不必仔细阅读所有内容!
:
答案 0 :(得分:4)
问题似乎是IE-8(只有那个.. )将只有空格的跨区视为空(自闭标签)。
谷歌因为这个原因在关键字之间添加了空格,以便在需要时中断。
幸运的是,他们在该范围内添加了一个类,因此我们可以通过执行
来使用CSS来欺骗它.statusItemSep_gsnb:after{content:' ';}
这会在它们之后放置一个空格并使IE表现出来。
的工作示例答案 1 :(得分:0)
你是否尝试过设置标题元素的高度(只是标题有问题,而不是整个事情)?尝试设置为固定的px,然后设置为auto(如果有效)。