+ 2
style a part of <p>
<p> my birthday is on 2 march 2001 <p> how can i only style the date in p tag in CSS suppose i want to underline it make it bold change its color of only the date
14 Antworten
+ 4
Do you need something like this
https://code.sololearn.com/W56I80x9oryP/?ref=app
+ 6
U can either use this inside your style tag or CSS
//Your HTML <p> ....... </p>
body{
}
p{
color : red;
text-decoration : underline ;
}
+ 3
What do you mean by separate CSS file?
+ 3
thanks everyone for help
+ 3
Abae salae Tujae Ya Bhi Nahi Ata 😂😂😂😂😂😂
+ 2
thanks that exactly what looking for but is there any way i can do it in seperate css file
+ 2
thanks everyone i got it thanks for help
+ 2
Place the date in a span tag, you can assign a class to the span and style it or just go ahead and style the span tag in CSS.
SYNTAX:
<p> my birthday is on <span> 2 march 2001 </span> </p>
+ 2
You can do this:
HTML:
<p> my birthday is on <span id="date">2 march 2001.</span></p>
CSS:
#date {
color: red;
text-decoration: underline;
}
You can make the entry shorter without using CSS:
<p>my birthday is on <span style="color:red; text-decoration:underline">2 march 2001.</span></p>
+ 2
It can be use in or outside it too
+ 1
if i use p{
color : red;
text-decoration : underline ;
}
this it will also style the whole para but i only want to style "2 march 2001" part
+ 1
Use inline element as _style=""_
Or use external css file
+ 1
nilesh can u tell me
+ 1
<head>
........
.......
...
<style>
.dataMatching { text-decoration: underline; }
</style>
</head>
<p>my birthday is on <div class="dataMatching">2 march 2001</div></p>
P.S. hope it helped u😺