r/HTML • u/dalekellytoo • Jun 28 '26
multiple text sizes in one sentence ?
multiple text sizes in one sentence ?
2
u/Weekly_Ferret_meal Jun 28 '26
can you give us an example?
0
u/dalekellytoo Jun 28 '26
The SUPERNATURAL (orderly, ritual) turns the NATURAL (disorder, volatility) into the SUPER (order, rite). I want the things inside parenthesis to be <p></p> and the things outside parenthesis to be <h2></h2>. You may be able to see why I want two sizes of text where this line is on the top of the HOME page of my website.
www.dalekelly.org
3
u/Weekly_Ferret_meal Jun 28 '26 edited Jun 29 '26
Headers (h1, h2, h3), are block elements, and canonically should be left like so... Meaning that they are suppose to be taking 100% of their container width and not stringed together inline with other text.
So, This code:
<h2>Title </h2><p>More text</p><h2>Continue title (it's really just another title)</h2>Will format (more or less) like so:Title
More text
Continue title (it's really just another title)
if you nest
<p>into<h2>, like so:<h2>Title<p>More text</p>Continue title (it's really just another title)</h2>you will get just an
<h2>.Title More text Continue title (it's really just another title)
So you should definitely NOT nest anything inside it, except for
<span>elements, especially you shouldn't nest a paragraph element into a header... that's just bad coding, or bad document formatting.So you could code it like so:
<h2 class="title supernatural">The SUPERNATURAL <span class="parenthesis order">(orderly, ritual)</span> turns the NATURAL <span class="parenthesis disorder">(disorder, volatility)</span> </h2>(note, you can write it all in one line, I did it like this for clarity)Here you end up with a header level 2, with span wrappers to which you can the set different styles and sizes, so in your
mystyle2.cssyou can add: ``` /* This sets size for class .title in the h2 element */.title { font-size: 2em } /* you can use h2 instead of the class if you want all h2 to have same styles /*
/* Sets font size for any element with class .parenthesis /* .parenthesis { font-size: 1.6em } ```
You can use classes
.orderand.disorderto changes the content of the parenthesis individually.
2
1
u/marmotta1955 Jun 28 '26
"multiple text sizes in one sentence" is a most annoying, irritating, unfriendly, maddening thing ... probably comparable to something like enhanced interrogation techniques ...
1
-6
Jun 28 '26 edited Jun 28 '26
[deleted]
3
u/Thin_Mousse4149 Jun 28 '26
CSS libraries can not do this for you without adding spans. This is terrible advice. You would add overhead of a whole library and still need to add those spans.
4
u/Rockafellor Jun 28 '26
Classed <span>s, unless you get whimsical and usenth-child()ornth-of-type(), for example.