-
Aug 6th, 2020, 02:14 AM
#1
Thread Starter
Member
how can i centere block eliminate using css1?
how can i centere block eliminate using css1?
< advertising removed by moderator >
-
Aug 6th, 2020, 09:32 AM
#2
Re: how can i centere block eliminate using css1?
To center a block element using CSS1, you will need to follow the CSS, Level 1 - Horizontal Formatting of Block Elements guideline. Specifically:
Otherwise, if both 'margin-left' and 'margin-right' are 'auto', they will be set to equal values. This will center the element inside its parent.
Here is an example:
Code:
div {
border: 1px solid black;
height: 250px;
margin-left: auto;
margin-right: auto;
width: 250px;
}
Fiddle: Live Demo
-
Mar 3rd, 2021, 07:22 AM
#3
Banned
Re: how can i centere block eliminate using css1?
To center block element with CSS1 we have to use the margin property. By setting the values of margin-left to auto and margin-right to auto and width to some explicit value: block level element will center itself.
-
Mar 8th, 2021, 02:21 AM
#4
Member
Re: how can i centere block eliminate using css1?
To center block element with CSS1 This is done by setting the properties margin-left and margin-right to auto and width to some explicit value:
Here is an example
HTML Code:
<html>
<head>
<style type="text/css">
p{
border:1px solid black;
width: 220px;
margin-left: auto;
margin-right: auto
}
</style>
</head>
<body>
<p> center block element</p>
</body>
</html>
Last edited by dday9; Mar 8th, 2021 at 09:40 AM.
< advertising removed by moderator >
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|