Some of my CSS doesn't get applied |
Some of my CSS doesn't get applied |
stowman |
Oct 17 2020, 12:25 PM
Post
#1
|
Group: Members Posts: 2 Joined: 17-October 20 Member No.: 27,599 |
I have an HTML hand-coded page at www.jcom.nu/about/index.php
If you click any of the 3 underlined headings, an accordion opens to show the content of the article. I added to the code of FIRST ARTICLE's content: <span style="font-family:'roboto condensed', serif; font-size:2em; color:green; line-height:0.2em;"> The font-family works (it becomes Roboto Condensed) The font-size works (it is 2em, too big to use, but here to make it obvious) The color works (it is green, or whatever else I change it to) BUT the line-height of 0.2em (which I have made deliberately small so it would be obvious) is not being applied! Can anybody help me get this line-height to work??? |
pandy |
Oct 17 2020, 12:45 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
'line-height' only applies to block level elements, not inline elements. If you change that SPAN to a P it will work. And it really should be a P. It's a paragraph, isn't it? So is the next line of text.
Use SPAN only when needed, and never use SPAN + BR to create paragraphs. I expressed myself a little sloppily. 'line-height' does apply to inline elements in w3c speak, but it won't create the effect you want, it doesn't work the way you want. http://www.w3.org/TR/CSS21/visudet.html#propdef-line-height |
stowman |
Oct 17 2020, 01:29 PM
Post
#3
|
Group: Members Posts: 2 Joined: 17-October 20 Member No.: 27,599 |
Thank you, Pandy.
That was exactly the explanation I needed, and the problem is now solved. I have changed my spans to <p class="PARA"> with </p> at the end of the paragraph. And I have put my style into <style>.PARA {font-family:'roboto condensed',serif;font-size:1.2em;color:black;line-height:1.05em;margin:0 0 6px 0;text-align:justify;"}</style> at the top of the file. And all now works exactly as I want. Thank you. again. And (in these difficult times) my wish is that you Stay Safe. |
pandy |
Oct 17 2020, 01:36 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Great. You stay safe too!
|
Lo-Fi Version | Time is now: 23rd April 2024 - 02:25 AM |