Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Centre align and V align my text it wont work :(

Featured Replies

Ok so here goes, ive made myself a nice looking CSS button my text is centre aligned, however it wont seem to align to the midle of the whole box.

 

These are going to be my bottons for my small image gallery.

 

please help

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.buttonbox {
width:300px;
height:30px;
text-align:left;
}
.imagebutton {
width:20px;
height:30px;
background-color:#999999;
border:solid 1px #000000;
text-align:center;
float:left;
}
.imagebutton:hover {
width:20px;
height:30px;
background-color: #FF0066;
border:solid 1px #000000;
text-align:center;
float:left;
}
.link2 {
text-decoration:none;
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
.link2:hover {
text-decoration:none;
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>button</title>
</head>
<body>
<div class="buttonbox">
<a href="#" class="link2">
<div class="imagebutton">1</div>
</a><a href="#" class="link2">
<div class="imagebutton" style="margin-left:10px">2</div>
</a>
<a href="#" class="link2">
<div class="imagebutton" style="margin-left:10px">3</div>
</a>
<a href="#" class="link2">
<div class="imagebutton"style="margin-left:10px">4</div>
</a>
</div>
</body>
</html>

try to put

line-height:30px;

 

In the css from .imagebutton

Also I don't think its valid to put a <div> between <a> tags.

The code incorporating the line-height: 30px; and using span instead of div inside the "a" tag would be:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.buttonbox {
width:300px;
height:30px;
text-align:left;
}
.imagebutton {
width:20px;		  line-height: 30px;
height:30px;
background-color:#999999;
border:solid 1px #000000;
text-align:center;
float:left;
}
.imagebutton:hover {
width:20px;
height:30px;
background-color: #FF0066;
border:solid 1px #000000;
text-align:center;
float:left;
}
.link2 {
text-decoration:none;
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
.link2:hover {
text-decoration:none;
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
</style>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>button</title>
</head>
<body>
<div class="buttonbox">
<a href="#" class="link2"><span class="imagebutton">1</span></a>
<a href="#" class="link2"><span class="imagebutton" style="margin-left:10px">2</span></a>
<a href="#" class="link2"><span class="imagebutton" style="margin-left:10px">3</span></a>
<a href="#" class="link2"><span class="imagebutton"style="margin-left:10px">4</span></a>
</div>
</body>
</html>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.