+ 16

How can I change the font-size and font-weight of two words in same paragraph

5th Jun 2019, 6:15 AM
Kratika Soni
22 Réponses
+ 2
In your html file <p> <div class ="first">first style</div> <div class="second">second style</div> In your css file .first{ Font-size:50px; } .second{ Font-size:30px; }
15th Aug 2019, 6:51 AM
Sadriddin Giyosiddinov
Sadriddin Giyosiddinov - avatar
+ 20
Add span tag within the words in the same paragraph. style that span class.
5th Jun 2019, 6:18 AM
Calviղ
Calviղ - avatar
+ 9
Use Css Wait a min say In html <p><div class ="Hello">Hello</div><div class="hye">Hye</div> In css .Hello{ Font-size:10px; } .hye{ Font-size:15px; } You can try All The best for your Future Codes.
6th Jun 2019, 9:07 AM
Sophia
Sophia - avatar
+ 8
Using CSS.
5th Jun 2019, 9:31 AM
Sonic
Sonic - avatar
+ 5
You can add Id or class attribute for the particular words within p tag...and after that style them using CSS. Hope it helps!
5th Jun 2019, 5:00 PM
Priyanka Bharti
Priyanka Bharti - avatar
+ 4
U can use style attribute- <img style="border:2px solid;" src="photo.jpg">
5th Jun 2019, 11:19 AM
Temur Azimov
Temur Azimov - avatar
+ 2
You can do this without CSS also with <h> tags to control size and <b> or <strong> for font-weight https://www.w3schools.com/html/html_formatting.asp
5th Jun 2019, 4:05 PM
Tom
Tom - avatar
+ 2
You can do that with <span> element for example: html <p>I like <span class="twowords">Solo Learn<span><p> css span.twowords{ color: blue; font-size: 18px; }
23rd Jun 2019, 11:10 PM
Ali
Ali - avatar
+ 1
Like its been answered earlier, just a working example here: <p>Here <span style:font-size:5px;font-weight:bold;>is<\span> the <span classSelector>paragraph<\span><\p>
6th Jun 2019, 7:14 AM
Aminu Idris
Aminu Idris - avatar
+ 1
In my opinion the best soultion would be warpping the two words with span tag and then style the span in css Edit: you can also use inline css in the paragraph
6th Jun 2019, 8:49 AM
David
David - avatar
+ 1
Use CSS instead of trying strong or bold as you'll have better control over the style using CSS. Checkout the CSS course in sololearn.
6th Jun 2019, 3:58 PM
Talluri Saisumanth
Talluri Saisumanth - avatar
+ 1
Sophia Thanks for sharing, but you should use <span> in the paragraph element instead of <div>. That way you won't have a line break in the paragraph and the <p> element will be properly closed. We generally use div as a container for styling many elements at once. So if you add style to the div, then all elements in the div will gain the divs properties. <style>.bg-green{background-color:green; } .Hello{ font-size:10px; } .hye{ font-weight:bold; font-size:15px; } </style> <div class="bg-green"> <p><span class ="Hello">Hello</span><span class="hye"> Hye</span></p> </div>
6th Jun 2019, 7:51 PM
Chris Coder
Chris Coder - avatar
0
How can i set border for image usin html alone
5th Jun 2019, 10:50 AM
Abiodun Adeniji
Abiodun Adeniji - avatar
0
Tout Can use thèse balise br
5th Jun 2019, 2:01 PM
Yapo Richard Rodrigue
Yapo Richard Rodrigue - avatar
0
you can use any of the css selectors.
5th Jun 2019, 6:49 PM
Ayush Agrawal
Ayush Agrawal - avatar
0
Kratika Soni you can use style for that part or use can make use of div : class or heading tags also
6th Jun 2019, 5:52 AM
Mehul Rawal
Mehul Rawal - avatar
0
You can use any of the following way: 1. You can use span tag with style property for those 2 words. For e.g. <span style="font-size:20px; font-weight:bold;"></span> 2. You can assign class or id for those two words and with css you can apply styling. For e.g. <span id="title"></span> and then apply css as #title{ font-size:20px; font-weight:bold;} You can use class as well in the same way. 3. Or you can also make use of header tags and bold tag if it is convenient. But the above two options are more customizable.
7th Jun 2019, 2:32 AM
Leena
0
Write the code as shown below HTML: <p>This is a <span class="font-size">beautiful</span> <span class="font-weight">flower</span></p> CSS: .font-size { font-size: 20px; } .font-weight { font-weight: bold; (you can write the value as needed) } Hope It Will Help Thank you
7th Jun 2019, 4:24 AM
Atharva Varule
Atharva Varule - avatar
- 1
You can use Strong or bold function in HTML
6th Jun 2019, 1:46 PM
Anuj Raghu
Anuj Raghu - avatar
- 1
Using CSS code for example .p{.....}
6th Jun 2019, 5:06 PM
Mr. Tejas Dixit
Mr. Tejas Dixit - avatar