I'm using CSS to style my labels, and I'd like to have the first line styled differently to the rest of the rest of the label.
How do I do this?
Different Style for Different Text in Same Label (CSS)
Re: Different Style for Different Text in Same Label (CSS)
You can pass HTML to a label. Is the method I use for this.
Re: Different Style for Different Text in Same Label (CSS)
I was under the impression that you could somehow tag specific parts of the label, but I can't quite remember, or find anything online on how it can be done.
Re: Different Style for Different Text in Same Label (CSS)
If you're familiar with HTML, it's fairly trivial. Here's an (untested) example of an inline style:
You'll want to look up some CSS to throw in the style attribute. You can also pass style information in tag format, but it's a little less flexible/more verbose.
Code: Select all
<p style="color: blue">Some blue text.</p>
<p style="color: red">Some red text.</p>
Re: Different Style for Different Text in Same Label (CSS)
Oh yeah, I remember how it's done now, but it doesn't seem to be working on Mudlet.
This as the text:
This as the CSS:
This would work when doing regular HTML, but it doesn't seem to do anything in Mudlet. Am I doing something wrong, or is it just not implemented?
This as the text:
Code: Select all
<p class="a">Test</p>
<p class="b">Test2</p>
Code: Select all
p.a {
font-size: 13px;
}
p.b {
font-size: 9px;
}
Re: Different Style for Different Text in Same Label (CSS)
I dropped this code into an alias exactly as shown here, and it works as expected. Are you getting errors? Are you looking at said errors?
Re: Different Style for Different Text in Same Label (CSS)
Sorry, I meant my HTML + CSS example doesn't work, not yours.
Basically, CSS Selectors don't work, so I guess I'll have to use HTML for any formatting.
Basically, CSS Selectors don't work, so I guess I'll have to use HTML for any formatting.
Re: Different Style for Different Text in Same Label (CSS)
How were you using them? That is, what commands?
Re: Different Style for Different Text in Same Label (CSS)
Using Geyser, I have code as follows:
I'd expect it to color the background white, while making the background of "Class a" cyan, but instead it makes the whole thing cyan. It seems to be ignoring the CSS class selector and just applying it regardless.
Code: Select all
css = CSSMan.new([[
background-color: rgb(255, 255, 255);
.a {
background-color: rgb(0, 255, 255);
}
]])
x = Geyser.Label:new({
name = "x",
x = 0,
y = 0,
width = "10%",
height = "10%",
})
x:setStyleSheet(css:getCSS())
x:echo([[
<p class="a">Class a</p>
<p class="b">Class b</p>
]])
Re: Different Style for Different Text in Same Label (CSS)
Yeah, it might not be accounting for the CSS selectors.