+ 3
Can we use two or more attribute in one tag? ex= <p align="center" border="2" > Plz reply </p>
6 Réponses
+ 10
you can use all supported attributes at once in a single tag. but remember that it's better to style tags with css ;)
+ 3
Yes, you can, but I'd suggest using the style tags, even if they are just inline style tags. In HTML5, it's always better to keep the styling separate from the text/elements of the page.
So, with the style tags, your code will be like this:
<p style="text-align:center; border: 2px solid black;> Plz reply </p>
This will create a solid black border of a width of 2 pixels around your paragraph, where the text is centered.
+ 2
Simple as Mario said, yes you can use more then one attribute inside a TAG
so in your example.
p - this is the TAG
text-align="center" this is a attribute
But as Mario pointed out its more efficient to use css in two ways.
INLINE CSS
<p style="text-align:center; border: 2px">Some Text</p>
External CSS (Written in a .css file and gotten in the header)
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
the content of mystyle.css would then be
.p {
text-align: center;
border: 2px;
}
+ 1
Yes, but as was mentioned. You want to keep styling separate from the structure of a page.
0
You can but I wouldn't advise it. Is there a specific project or problem this trying too solve or is this just a knowledge base question?
0
it's possible but like Jim said always keep styles on a separate file