Thursday, November 30, 2023
HomeFun With ProgrammingHow to center a fieldset in HTML using CSS?

How to center a fieldset in HTML using CSS?

For that you have to position the element absolutely, offsetting the div by 40% or 50% from the left and if you want to center vertically than the top part also offeset by 50% else offset it by ur requirements of the window and move the div to the left and to the top with half its width and height with a negative margin, to have it perfectly centered.

and this is the CSS code:

    position:absolute;
    left:40%;
    top:20%;
    margin:-100px 0 0 -150px;

More Question Answered:–

Previous article
Next article
Rahul K Raj
Rahul K Rajhttps://rkrknowledge.com/
Hi πŸ‘‹, I'm Rahul Raj Kushwaha also known as Rahul K Raj. A passionate full-Stack developer from India. You can call me: Entrepreneur | Youtuber | Blogger | Coder | Developer | UI Designer | Hacker | Music Composer. I like to share my knowledge on such great platforms like RKR Knowledge. I try to learn something new every day.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Stay Connected

33FansLike
60FollowersFollow
520SubscribersSubscribe

Most Popular

Recent Comments