5

I'm new to ReactJS. In the react component, I've

    var SaveOrganization = React.createClass({
    render: function () {
    return (
        <div className="box-footer" align="center"> 
            <a href="addVenue" className="btn btn-info bottom-margin" >Add Venue</a>
            <a href="addCourt" className="btn btn-info bottom-margin" >Add Court</a>
            <a href="addPOI" className="btn btn-info bottom-margin" >Add POI</a>                    </div> 
    );
}})

But when I see the browser after rendering "align" attribute doesn't show up at all. Please help me on this.

2
  • HTML 5 doesn't have an align attribute. Use CSS instead. Commented Jul 14, 2016 at 7:14
  • I thought so! My mistake. Will correct the question to say just "html". But, would like to know was align attribute there from before or which version had it? Commented Jul 14, 2016 at 11:06

1 Answer 1

12

Yes, it seems that align is not supported by React. Here is the full list.

I'd suggest using style (or css) instead:

return (
    <div className="box-footer" style={{textAlign:"center"}}> 
        <a href="addVenue" className="btn btn-info bottom-margin" >Add Venue</a>
        <a href="addCourt" className="btn btn-info bottom-margin" >Add Court</a>
        <a href="addPOI" className="btn btn-info bottom-margin" >Add POI</a>                    </div> 
);
Sign up to request clarification or add additional context in comments.

3 Comments

@MamathaVRao you should accept his answer if it's truly perfect :)
i also think this has to do with the fact that "align" isn't supported in html5. Most browsers always try to be compatible so your old align tags would still work
align attribute and text-align styles are not same

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.