Float not working in CSS - css

I've inline CSS like this. But the float is not working.
<div style='clear:both'>
<div style='display:block;float:right;margin:10px;width:200px'>
<img src = 'http://knowafest.co.in/images/logo.png' height='200px' width='200px'/>
</div>
</div>
I tested code in this page - http://test-knowafest.blogspot.in/2013/03/fuseout-2013-government-engineering.html
You can see the image next to post title. The image is not getting floated. I tried several combinations of paramaters in style, but it is not working. Can you anyone tell me where I went wrong.
It looks like below now
====================================
But I want it like below.

Here is the WORKING SOLUTION
The Code:
<div id="post-body-3682190942132900250" class="post-body entry-content">
<div style="clear: both; overflow: hidden; display: inline; background: none repeat scroll 0% 0% red;">
<div style="float:right;margin:10px;width:200px">
<img width="200px" height="200px" src="http://knowafest.co.in/images/logo.png">
</div>
</div>
<div style="display: table-cell;">
<!-- The New Addition is here -->
<div trbidi="on" style="text-align: left;" dir="ltr">
<div style="clear: both; text-align: center;" class="separator"></div>
<span id="fullpost"> This information is brought to you by <a target="_blank" href="http://knowafest.com/">www.knowafest.com</a> </span>
<br>
<hr>
<span id="fullpost"><span style="font-weight: bold;">Event:</span> Fuseout 2013 | Technical Fest
<br>
<br><span style="font-weight: bold;">Fuseout 2013 is Organised by:</span> Government Engineering College, Trivandrum, Kerala
<br>
<br><span style="font-weight: bold;">Fuseout 2013 dates:</span>
<br>Fest dates: 15th-17th March 2013
<br>Last Dates for Registration: Spot Registrations Open
<br>
<br><span style="font-weight: bold;"> Details:</span>
<br>Fuseout Is A Technical Fest Organised By The Electrical And Electronics Department Students Of Govt Engineering College Barton Hill ,Trivandrum As Part Of AAGNEYA'13 Aiming To Bring Together The Intellectual Minds Of Our Country In A Competition Like None Other.
<br>
<br><span style="font-weight: bold;">Fuseout 2013 Technical Events in Trivandrum :</span>
<br>Robotron
<br>Circuito Metego
<br>Scrap Maniac
<br>Wire-In
<br>
<br><span style="font-weight: bold;">Fuseout 2013 Co-ordinators Details:</span><span style="color: green;"><br>Leo K A<br>9995992755</span>
<br><span style="font-weight: bold;">How to reach Government Engineering College: </span>
<br>At Kanakakunnu Palace Grounds
<br>
<br><span style="font-weight: bold;">Fuseout 2013 Website: </span><a target="_blank" href="http://tinyurl.com/fuseout2">http://tinyurl.com/fuseout2</a>
<br><span style="font-weight: bold;">Fuseout 2013 Facebook Link: </span><a target="_blank" href="http://www.facebook.com/fuseout.aagneya"><img src="http://knowafest.co.in/images/icons/facebook.gif"></a>
<br><span style="font-weight: bold;">Fuseout 2013 Youtube Link: </span><a target="_blank" href="http://www.youtube.com/watch?v=TP4igb1dMdk"><img src="http://knowafest.co.in/images/icons/youtube.gif"></a>
<br>
<br>
<br><span style="font-weight: bold;">Fuseout 2013 Event Departments: </span>CSE, ECE, IT, EEE, Instrumentation, Mechanical, Energy, Arts</span>
</div>
</div>
<div style="clear: both;"></div>
</div>
I hope this serves your purpose.

You have problem with clear: both following you floating content:
<div style="clear: both; overflow: hidden; display: inline; background: none repeat scroll 0% 0% red;">
<div style="float:right;margin:10px;width:200px">
<img height="200px" src="http://knowafest.co.in/images/logo.png" width="200px">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
Please remove it to get it worked as you wish (I hope).
<div style="clear: both; overflow: hidden; display: inline; background: none repeat scroll 0% 0% red;">
<div style="float:right;margin:10px;width:200px">
<img height="200px" src="http://knowafest.co.in/images/logo.png" width="200px">
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="text-align: center;">
</div>

*strong text*Maybe this is something that you want.
DEMO
You need to use the float:right style only on you image. Also check where you used the clear:both styling. That will mess with the alignment too.
<img src="http://knowafest.co.in/images/logo.png" width="95" height="84" style="float:right" /> <span id="fullpost">

Related

Convert style and html to gmail capable

I tried many times on sending an html with style email to gmail, but it always destroy the style it expected look like in normal HTML. Anyone could kindly help me to convert it to gmail capable that must look exactly the same it should be? Thank you.
<div style="display: flex;justify-content: center;">
<div class="container" style="font-family: 'Manrope-Regular';max-width: 600px;border-style: solid;border-color: #7E7E7E;position: relative;height: fit-content;border-width: 1px;">
<img class="top-bg" src="https://saas-staging-wp.chatsmart.io/wp-content/uploads/revslider/slider-1/1-Path 842 (1).png" style="max-width: 255px;position: absolute;right: 0;">
<img class="bottom-bg" src="https://saas-staging-wp.chatsmart.io/wp-content/uploads/revslider/slider-1/1-Path 841.png" style="position: absolute;left: 0;bottom: 0;max-width: 270px;">
<div class="logo" style="font-family: 'Manrope-Regular';">
<img src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/08030440/mobile-menu-logo.png" style="margin: 41px auto;display: block;">
</div>
<div class="content" style="font-family: 'Manrope-Regular';margin: 0 100px;">
<p class="header" style="font-family: 'Manrope-Regular';">Hi [first_name] [last_name],</p>
<p class="para" style="font-family: 'Manrope-Regular';">Welcome to ChatSmart! Experience the powerful ChatSmart features to let you easily reach your customers. Not only increase customers loyalty through broadcast messages, but also lower abandon cart rate by supporting eCommerce platforms. Create your sales revenue by 24 / 7 answer customers' enquiries!
</p>
<p class="para" style="font-family: 'Manrope-Regular';">
<strong>Some popular resources which would be useful for you:</strong>
</p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">How to login & connect WhatsApp? (Cantonese)</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">How to start the chat with your customer? (Cantonese)</span></li>
</ul>
<br>
<p class="para" style="font-family: 'Manrope-Regular';">
For more support, you may find below:
</p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">ChatSmart User Guide (Traditional Chinese)</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Technical Support</span></li>
</ul>
<br>
<p class="para" style="font-family: 'Manrope-Regular';">Click below button to start your journey in ChatSmart!</p>
<a class="button button-text" href="[link]" style="justify-content: center;display: flex;">
<img style="max-width: 206px;" src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/21125343/login.png"/>
</a>
<br>
<p class="para" style="font-family: 'Manrope-Regular';">More super practical content is on the way, stay tuned!</p>
<br>
<p class="para" style="font-family: 'Manrope-Regular';">Thanks,</p>
<br>
<p class="signature" style="font-family: 'Manrope-Regular';font-weight: bold;">
ChatSmart Team<br>
Your Best WhatsApp Marketing Platform
</p>
<br>
<div class="soscial" style="font-family: 'Manrope-Regular';">
<img src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/06145810/Group-764.png" style="margin-right: 20px;">
<img src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/06150156/1-Group%20766.png" style="margin-right: 20px;">
</div>
<br>
<div class="footer" style="font-family: 'Manrope-Regular';text-align: center;font-size: 8px;margin-bottom: 20px;">
©2021 ChatSmart, Inc. All rights reserved.
</div>
</div>
</div>
</div>
Updated: Included a version of style and head block.
<html>
<head>
<style>
#font-face {
font-family: 'Manrope-Regular';
src: url('https://saas-staging.chatsmart.io/font/Manrope-Regular.ttf') format("opentype");
}
p, div {
font-family: 'Manrope-Regular';
}
body{
display: flex;
justify-content: center;
}
.container {
max-width: 600px;
border-style: solid;
border-color: #7E7E7E;
position: relative;
height: fit-content;
border-width: 1px;
}
.top-bg {
max-width: 255px;
position: absolute;
right: 0;
}
.bottom-bg {
position: absolute;
left: 0;
bottom: 0;
max-width: 270px;
z-index: -1;
}
.logo img {
margin: 41px auto;
display: block;
}
.content {
margin: 0 100px;
}
a.button {
text-decoration: none;
}
.signature {
font-weight: bold;
}
.soscial img {
margin-right: 20px;
}
.footer {
text-align: center;
font-size: 8px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="container">
<img class="top-bg" src="https://saas-staging-wp.chatsmart.io/wp-content/uploads/revslider/slider-1/1-Path 842 (1).png" />
<img class="bottom-bg" src="https://saas-staging-wp.chatsmart.io/wp-content/uploads/revslider/slider-1/1-Path 841.png" />
<div class="logo">
<img src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/08030440/mobile-menu-logo.png" />
</div>
<div class="content">
<p class="header">Hi [first_name] [last_name],</p>
<p class="para">Welcome to ChatSmart! Experience the powerful ChatSmart features to let you easily reach your customers. Not only increase customers loyalty through broadcast messages, but also lower abandon cart rate by supporting eCommerce platforms. Create your sales revenue by 24 / 7 answer customers' enquiries!
</p>
<p class="para">
<strong>Some popular resources which would be useful for you:</strong>
</p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">How to login & connect WhatsApp? (Cantonese)</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">How to start the chat with your customer? (Cantonese)</span></li>
</ul>
<br/>
<p class="para">
For more support, you may find below:
</p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">ChatSmart User Guide (Traditional Chinese)</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Technical Support</span></li>
</ul>
<br/>
<p class="para">Click below button to start your journey in ChatSmart!</p>
<a class="button button-text" href="[link]" style="justify-content: center;display: flex;">
<img style="max-width: 206px;" src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/21125343/login.png"/>
</a>
<br/>
<p class="para">More super practical content is on the way, stay tuned!</p>
<br/>
<p class="para">Thanks,</p>
<br/>
<p class="signature">
ChatSmart Team<br/>
Your Best WhatsApp Marketing Platform
</p>
<br/>
<div class="soscial">
<img src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/06145810/Group-764.png" />
<img src="https://chatsmart-saas.s3.ap-east-1.amazonaws.com/wp/images/2021/01/06150156/1-Group%20766.png" />
</div>
<br/>
<div class="footer">
©2021 ChatSmart, Inc. All rights reserved.
</div>
</div>
</div>
</body>
</html>
You need a complete redesign. You can't develop emails like websites, because there are lots of restrictions. For example, you need to write code inline, not rely on embedded CSS (within <style>...</style>); and things like divs and flexbox are temperamental - see caniemail.com.
Check out any HTML email template, or HTML email course, and then make sure you test in a variety of email clients on a variety of devices.

CSS: Prevent wrap between spans

I have the following html-code:
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
My problem is that sometimes the text is wrapped before €, so I get:
My really super product 19,99
€
I would prefer:
My really super product
19,99 €
The problem is: I only could add an additional tag arround this code but couldn't change the code itself (because it's generated by a 3rd-party-tool). Okay, it would be possible somehow replaceing the output, but the real code is more complicated than this example.
So is it possible to prevent the wrap between price and currency only by CSS?
Added: Sorry, I forgot to mention. It should be possible to get
My really super product 19,99 €
in one line as well if there is enough space in width.
Maybe something like this will suit
Variant 1
.wrapper {
position: relative;
}
.wrapper .price {
padding-right: 20px;
}
.wrapper .currency {
position: absolute;
margin-left: -15px;
}
<div class="wrapper">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
<br>
<div class="wrapper" style="width: 200px; background-color: yellow;">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
<br>
<div class="wrapper" style="width: 155px; background-color: #0f0;">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
<br>
<div class="wrapper" style="width: 140px; background-color: #99f;">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
Here .wrapper is not really necessary. In most cases you may add the style just for .price and .currency. Try to inject the solution into you layout and review.
Variant 2
.price {
padding-right: 1em;
}
.currency {
margin-left: -1em;
}
<div>
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
<br>
<div style="width: 200px; background-color: yellow;">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
<br>
<div style="width: 155px; background-color: #0f0;">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
<br>
<div class="wrapper" style="width: 140px; background-color: #99f;">
<span class="product">
My really super product
</span>
<span class="price">19,99</span><span class="currency"> €</span>
</div>
U have to use <br/> may this will help you to add the data like that
<span=class="">
My really super product</Span><br/>
<spa="">19,99</span><span="">$</span>

Div tags with float left not printing properly

I have a layout that has a container div tag and some nested floating div tags. I'm using them in this manner to have two column effect (rather than do table cells). On the web page, everything renders fine. But when I print, the floating ones aren't showing up correctly. It's a sequence of 2 sets of container div/floating divs and then a full width div tag (no floating). Here's the code:
<div style="margin-bottom: 5px; border-top: 1px solid #000000; padding: 5px; font-size: 0;">
<div style="display: inline-block; width: 50%; vertical-align: top; font-size: 11px;">
<span style="font-weight: bold;">Provider: </span>
Name here
</div>
<div style="display: inline-block; width: 50%; vertical-align: top; font-size: 11px;">
<span style="font-weight: bold;">Location: </span>
Name<br/>
Street Address<br/>
City, State Zip<br/>
Phone
</div>
</div>
<div style="margin-bottom: 5px; border-top: 1px solid #000000; padding: 5px; font-size: 0;">
<div style="display: inline-block; width: 50%; vertical-align: top; font-size: 11px;">
<span style="font-weight: bold;">Appointments:</span>
<br />
No appointments scheduled
</div>
<div style="display: inline-block; width: 50%; vertical-align: top; font-size: 11px;">
<span style="font-weight: bold;">Care Team:</span>
<br />
Name Here
</div>
</div>
<div style="margin-bottom: 5px; padding: 5px; border-top: 1px solid #000000;">
<span style="font-weight: bold;">Referrals:</span>
<br />
No referrals available
</div>
As stated, everything renders correctly on the web page. Thanks to #avrahamcool I have it fixed so that the top border lines are showing up correctly. However, when I use IE9, I am getting what looks like the following:
Provider: Name here
Location: Name
Street Address
City, State Zip
Phone
Appointments:
No appointments scheduled
Care Team:
Name Here
Referrals:
No referrals available
It's working fine in Chrome. The provider/location and appointments/care team are split into two columns between the border lines when it's printed (and shows up fine on the screen)
I've completely recreated your markup, so I can work with it.
this is the result. (notice how beautiful this is?)
I've tested it in IE10, IE9, IE8, FF, Chrome.
also, printed from each one, and it works like a charm.
If you have to write your HTML & CSS combined (I don't see a reason for that.. but who am I to judge) I will try to help you apply my solution to your HTML.
So, the main Idea is to lose the float thing altogether, and use inline-block instead.
but, inline-block adds extra-spacing to the elements (caused by new-lines in the markup), causing 50% to be a little more than that, therefor making the columns not to fit in one row.
I've used one of many tricks to resolved that issue. by applying font-size:0; on the container, and reapplying font size on his children.
also, I had to verticaly-align:top; the columns.
so, to summarize, this is the end result.
New HTML markup
<div class="Container">
<div class="Column">
<span class="Header">Provider:</span>
<span>Name here</span>
</div>
<div class="Column">
<span class="Header">Location:</span>
<span>Name</span>
<br/>
<span>Street Address</span>
<br/>
<span>City, State Zip</span>
<br/>
<span>Phone</span>
</div>
</div>
<div class="Container">
<div class="Column">
<span class="Header">Appointments:</span>
<br/>
<span>No appointments scheduled</span>
</div>
<div class="Column">
<span class="Header">Care Team:</span>
<br/>
<span>Name Here</span>
</div>
</div>
<div class="Container">
<span class="Header">Referrals:</span>
<br/>
<span>No referrals available</span>
</div>
New CSS
*
{
margin: 0;
padding: 0;
}
.Container
{
margin-bottom: 5px;
border-top: 1px solid #000000;
font-size: 0;
}
.Container *
{
font-size: medium;
}
.Container .Column
{
display: inline-block;
width: 50%;
vertical-align: top;
}
.Container .Header
{
font-weight: bold;
}
Edit:
for some reason, I've dropped your padding. so here is a fiddle with padding in the container (all the rest is the same as before)
Edit 2 inline-style
<div style="margin-bottom: 5px;padding: 5px;border-top: 1px solid #000000;font-size: 0;">
<div style="display: inline-block;width: 50%;vertical-align: top;font-size: medium;">
<span style="font-weight: bold;">Provider:</span>
<span>Name here</span>
</div>
<div style="display: inline-block;width: 50%;vertical-align: top;font-size: medium;">
<span style="font-weight: bold;">Location:</span>
<span>Name</span>
<br/>
<span>Street Address</span>
<br/>
<span>City, State Zip</span>
<br/>
<span>Phone</span>
</div>
</div>
<div style="margin-bottom: 5px;padding: 5px;border-top: 1px solid #000000;font-size: 0;">
<div style="display: inline-block;width: 50%;vertical-align: top;font-size: medium;">
<span style="font-weight: bold;">Appointments:</span>
<br/>
<span>No appointments scheduled</span>
</div>
<div style="display: inline-block;width: 50%;vertical-align: top;font-size: medium;">
<span style="font-weight: bold;">Care Team:</span>
<br/>
<span>Name Here</span>
</div>
</div>
<div style="margin-bottom: 5px;padding: 5px;border-top: 1px solid #000000;">
<span style="font-weight: bold;">Referrals:</span>
<br/>
<span>No referrals available</span>
</div>
Inline-Style V2
so, its probably the font fix that doesn't work for you. It's hard for me to debug, because it's working fine for me. so lets try another approach.
this time, we will eliminate the spacing between columns by deleting the new line from the markup. try this new markup.
<div style="margin-bottom: 5px;padding: 5px;border-top: 1px solid #000000;">
<div style="display: inline-block;width: 50%;vertical-align: top;">
<span style="font-weight: bold;">Provider:</span>
<span>Name here</span>
</div><div style="display: inline-block;width: 50%;vertical-align: top;">
<span style="font-weight: bold;">Location:</span>
<span>Name</span>
<br/>
<span>Street Address</span>
<br/>
<span>City, State Zip</span>
<br/>
<span>Phone</span>
</div>
</div>
<div style="margin-bottom: 5px;padding: 5px;border-top: 1px solid #000000;">
<div style="display: inline-block;width: 50%;vertical-align: top;">
<span style="font-weight: bold;">Appointments:</span>
<br/>
<span>No appointments scheduled</span>
</div><div style="display: inline-block;width: 50%;vertical-align: top;">
<span style="font-weight: bold;">Care Team:</span>
<br/>
<span>Name Here</span>
</div>
</div>
<div style="margin-bottom: 5px;padding: 5px;border-top: 1px solid #000000;">
<span style="font-weight: bold;">Referrals:</span>
<br/>
<span>No referrals available</span>
</div>
media="print" like this:
<link rel="stylesheet" href="print.css" type="text/css" media="print" />
Doing this should make it look the same as web page
and yes depeding on the browser like isherwood said if that is what you are pointing at.

Arranging Div's with Headers

I a trying to stack 3 div's side by side. Here's a sample div
<!-- This is first div -->
<div id="divone" style="text-align: center;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
<!-- Similarly I need two more divs to be aligned sidebyside with div one -->
How can I do it using inline CSS? The width of each div can be 200px with no limit on height.
OUTPUT Required
-------------------- -------------------- --------------------
DIV ONE DIV TWO DIV THREE
-------------------- -------------------- --------------------
FORM ELEMENT FORM ELEMENT FORM ELEMENT
-------------------- -------------------- --------------------
Just because you can't change the stylesheet, doesn't mean you have to use ugly inline styles.
Add this to your <head>:
<style>
.three-columns{
width: 100%; /* or any width you like */
}
.three-columns .column{
float: left;
width: 33%; /* or less if you're using margins, padding, borders, etc */
}
</style>
Then in the page,
<div class="three-columns">
<div class="column"></div>
<div class="column"></div>
<div class="column"></div>
</div>
You can do all your additional css inside a style tag in the head. (Technically, I think you can use it outside the header, but try not to)
Try this:
<ul style="list-style: none;">
<li>
<div id="divone" style="">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
</li>
<li>
<div id="divtwo" style="">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
</li>
<li>
<div id="divthree" style="t">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
</li>
Demo here:
http://jsfiddle.net/7MZqN/
Set display: inline-block; to have the divs side-by-side, as follows:
<div id="divone" style="text-align: center; display: inline-block; width: 200px;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
<div id="divtwo" style="text-align: center; display: inline-block; width: 200px;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
<div id="divthree" style="text-align: center; display: inline-block; width: 200px;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
</div>
<div id="divone" style="text-align: center; width:33.33333%; float:left;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span></div>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
<div id="divtwo" style="text-align: center; width:33.33333%; float:left;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span></div>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
<div id="divthree" style="text-align: center; width:33.33333%; float:left;">
<span style="font-size: 11pt;"><strong>Some Message Here</strong></span></div>
<div style="text-align: center;">
<form action="https://www.somesomesomesome.com" method="post">
</form>
</div>
<div style="clear:both;"></div><!-- this is a clearfix div -->
DEMO: http://jsfiddle.net/EnkP5/
UPDATE: i just saw where you wanted the width to be 200px; Change the width from 33.33333% to 200px;
Make sure that the div that all three of these other divs sit in, are more than 600px wide.
​

Why does this vertical-align:middle fails in Jquery mobile

Am trying to middle a set of icons to the middle of screen, below is the code:
<div data-role="content" class="ui-content ui-body-a" style="vertical-align: middle" data-theme="a">
<fieldset class="ui-grid-a icon-set" style="vertical-align: middle" data-theme="b">
<div class="ui-block-a center" style="vertical-align: middle">
<a href="test">
<div>
<img src="css/images/test5.png" style="width: 80px;height: 80px"/>
</div>
<div>
Login
</div>
</a>
</div>
<div class="ui-block-b center">
<a href="#settings" data-transition='slide'>
<div> <img src="css/images/test4.png" style="width: 80px;height: 80px"/></div>
<div>Settings</div>
</a>
</div>
<div class="ui-block-a center">
<a href="test">
<div> <img src="css/images/test2.png" style="width: 80px;height: 80px"/></div>
<div>Aboutus</div>
</a>
</div>
<div class="ui-block-b center">
<a href="test">
<div> <img src="css/images/test1.png" style="width: 80px;height: 80px"/></div>
<div>Contact Us</div>
</a>
</div>
</fieldset>
</div>
vertical-align does not work as most people would expect - this property is only available for tables or elements that have style of table-cell or similar (http://www.w3schools.com/cssref/pr_class_display.asp)
you will need to give the DIV element a default size for this to work as well... check this JSBin example and this StackOverflow answer for more insight
Do this:
<div data-role="content" class="ui-content ui-body-a" style="text-align: center;" data-theme="a">
and then this for any div you want to center:
style="margin:0 auto;"

Resources