i have a div with two elements
<div style={{color:'black',justifyContent:'center',marginTop:'1.3rem'}}><span><b ><u>{galleyNo}</u></b></span><br/>
<span>{galleyItem}</span></div>
I am trying to give styles two the inner elements.I need underline for the text inside tag but giving it in tag doesn’t provide me the desired result.also i need to center align the texts inside the div what will be a probable css for this elements
3
Answers
Add
text-align: center;
to the container<div>
.Is your desired result something like this? (It seems you have not posted a lot of your code into this, but here’s what I’ve got so far with what you gave me [with cleaned-up code for clarity].)
I’m not sure in what way it is not giving you your desired result, perhaps I’ll need to see something in your original code?
And as for your centering of the text, this is all that’s required:
You used
justify-content
instead oftext-align
.P.S. Your
<span>
tags are doing nothing unless you have some CSS for them.For example:
The
<span>
tag doesn’t have any default styles, and I don’t see any JavaScript, etc. to do something with them. I would say they are doing nothing and that you should remove them, but I actually suggest that you not use the<b>
and<u>
tags, but rather the<strong>
and<em>
tags respectively, or do something like give the<span>
tagclass="bold underline"
and add this CSS:or add the CSS inline like this:
for that you can use normal css, like this:
Important: W3C recommends to not use b tag, is old and not semantic, you should try another tags, like strong and em
See:
https://www.w3schools.com/html/html5_semantic_elements.asp
https://developer.mozilla.org/es/docs/Web/HTML/Element/b
http://html.conclase.net/w3c/html401-es/present/styles.html