ramiwahdan Posted March 12, 2020 Share Posted March 12, 2020 Hi, I have created buttons from php and html and have css for styling. the buttons come below each other as expected but they are not aligned to the same size. css: body { color: #fff; font: 87.5%/1.5em 'Open Sans', sans-serif; background:url(img/bg.jpg)no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;} .buttonstyle { background-color: #4CAF50; /* Green */ border: none; color: white; padding: 15px 80px; text-align: center; text-decoration: none; display: inline-block; font-size: 14px; margin: 5; } .form-wrapper { width:350px; height:280px; position: absolute; top: 50%; left: 50%; margin: -184px 0px 0px -155px; background: rgba(0,0,0,0.27); padding: 25px 25px; border-radius: 5px; box-shadow: 0px 1px 0px rgba(0,0,0,0.6),inset 0px 1px 0px rgba(255,255,255,0.04); } .form-item { width:100%; } h3{ font-size: 25px; font-weight: 640; margin-bottom: 10px; color: #e7e7e7; padding:6px; font-family:'sans-serif','helvetica'; } .form-item input{ border: none; background:transparent; color: #fff; margin-top:11px; font-family: 'Open Sans', sans-serif; font-size: 1.2em; height: 49px; padding: 0 16px; width: 100%; padding-left: 55px; } input[type='password']{ background: transparent url("img/pass.jpg") no-repeat; background-position: 10px 50%; } input[type='text']{ background: transparent url("img/user.jpg") no-repeat; background-position: 10px 50%; } .form-item input:focus { outline: none; border:1.4px solid #cfecf0; } .button-panel { margin-bottom: 20px; padding-top: 10px; width: 100%; } .button-panel .button { background: #00b6df; border: none; color: #fff; cursor: pointer; height: 50px; font-family: 'helvetica','Open Sans', sans-serif; font-size: 1.2em; text-align: center; text-transform: uppercase; transition: background 0.6s linear; width: 100%; margin-top:10px; } .button:hover { background: #6eb7cb; } .form-item input, .button-panel .button { border-radius: 2px } .reminder { text-align: center; } .reminder a { color: #fff; text-decoration: none; transition: color 0.3s; } .reminder a:hover { color: #cab6bf; } php: <?php include('dbcon.php'); include('session.php'); $result=mysqli_query($con, "select * from admin_login where username='$session_id'")or die('Error In Session'); $row=mysqli_fetch_array($result); ?> <html> <head> <link rel="stylesheet" type="text/css" href="style2.css"> </head> <body> <form action="test2.php" method="post"> <div class="form-wrapper"> <center><h3>Welcome: <?php echo $row['Name']; ?> </h3></center> <button type="submit" name = "adminmanagement" class="buttonstyle">Manage Admin Info</button> <button type="submit" name = "staffmanagement" class="buttonstyle">Manage Staff Info</button> <button type="submit" name = "reportsmanagement" class="buttonstyle">Manage Reports</button> <div class="reminder"> <p><a href="logout.php">Log out</a></p> </div> </div> </form> </body> </html> attached output, the buttons are not of same size... Thanks Quote Link to comment Share on other sites More sharing options...
requinix Posted March 12, 2020 Share Posted March 12, 2020 They aren't the same width because you don't have any sort of CSS in there that says anything about a width. It's not like the browser can read your mind about how you want it to appear... Have you tried giving the buttons a width? 1 1 Quote Link to comment Share on other sites More sharing options...
TrueMember Posted April 15, 2020 Share Posted April 15, 2020 You should add the width to the buttons, the content length is different, so the width when no specified will be different too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.