简体   繁体   English

html / css无法停止自定义标记开始新行

[英]html/css cannot stop custom tag from starting new line

I've made a floating ad tag in css: 我在CSS中制作了一个浮动广告代码:

CSS CODE--- CSS代码---

floatads {
    left:0;
    position:fixed;
    text-align:center;
    top:0;
    width:100%;
    z-index:10;
    background-color:#666666;
    border:3px #cccccc dashed;
    font-size:13px;
    color:#ffffff
    }

floatads .license {
    font-size:10px;
    color:#ffffff
    }

HTML CODE--- HTML代码-

<floatads>
<marquee width="70%" scrollamount="5" scrolldelay="20" vspace="5">
Enjoy! | Recommended Website : <a href="http://web-tool.weebly.com">web-tool.weebly.com</a> | Also check out : <a href="http://myzonehk.weebly.com">myzonehk.weebly.com</a> | To register your advertisement and host it here, email <a href="mailto:jamiechoi@mail.com?subject=Host my ad!&body=This is the content of my ad:">jamiechoi@mail.com</a>
</marquee><p class="license">Ads by tool-box.weebly.com</p>
</floatads>

But in <p class="license"> , it jumped to another line. 但是在<p class="license"> ,它跳到了另一行。

What can i do to stop it from jumping to another line? 我该怎么做才能阻止它跳到另一条线?

(What i want is:) (我想要的是:)

MARQUEE license MARQUEE许可证

license - 10px 许可-10像素
MARQUEE - 13px 字幕-13像素

How can i do this? 我怎样才能做到这一点? i just want it to be on the same line. 我只希望它在同一行。

ADDED------ 添加 - - -

Also tried this: 还尝试了以下方法:

(CSS) (CSS)

floatads #license {
    font-size:10px;
    color:#ffffff
}

(HTML) (HTML)

<p id="license">ads by tool-box.weebly.com</p>

Still not working. 还是行不通。

Any help will be appreciated. 任何帮助将不胜感激。

I suggest you use an inline element instead, which saves unnecessary css code. 我建议您改用内联元素,这样可以节省不必要的CSS代码。

<span id="license">ads by tool-box.weebly.com</span>

And one other thing, don't use marquee element, as it is non standard. 另外,不要使用marquee元素,因为它是非标准的。 There is other ways using javascript and css animations, that will work cross browser. 还有其他使用javascript和css动画的方法,这些方法可以跨浏览器工作。

Marquee is not a valid HTML element. 选取框不是有效的HTML元素。 From MDN: 从MDN:

Non-standard This feature is non-standard and is not on a standards track. 非标准此功能是非标准的,不在标准范围内。 Do not use it on production sites facing the Web: it will not work for every user. 请勿在面向Web的生产站点上使用它:它不适用于每个用户。 There may also be large incompatibilities between implementations and the behavior may change in the future. 实现之间也可能存在很大的不兼容性,并且将来的行为可能会更改。

By the way marquee is a block element, so you have to define its width and float it or make it inline. 顺便说一句,选取框是一个块元素,因此您必须定义其宽度并使其浮动或内联。 Example: 例:

marquee {
    width: 100px;
    display: inline-block;
}
#license {
    display: inline-block;
}

Or: 要么:

marquee {
    float: left;
    width: 100px;
}
#license {
    float: left;
    width: 100px;
}

Add display:inline; 添加显示:内联; to the floatads .license 到浮动许可证

floatads .license {
    font-size:10px;
    color:#ffffff;
     display:inline;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM