Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Css to add margin to column

Posted on 2013-06-26
3
Medium Priority
?
391 Views
Last Modified: 2013-06-26
I have this newspaper style column in css but I would like to add equal margin in left and right so it would center the 3 columns. right now it looks wide.
I applied it in a DIV in HTML. Should I need another DIV on top of this DIV to add the margin.
Please add the code necessary. thanks

.newspaper3
{
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
column-count:3;
0
Comment
Question by:zachvaldez
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
lightspeedvt earned 900 total points
ID: 39279538
No need to add more DIVs on top. Just assign some margins (for example 120px):
    margin-left:120px;
    margin-right:120px;

Open in new window


So, final CSS will be:
.newspaper3{
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */
    column-count:3;
    margin-left:120px;
    margin-right:120px;
}

Open in new window


Here is demo:
http://jsfiddle.net/2E3fp/
0
 

Author Comment

by:zachvaldez
ID: 39279559
That works perfect! What Id like to shift into is getting away from table structures-the td,tr,etc..
which I've previously use and instead use CSS with rows and cols that is controlled by DVs.
I'll be  creating a page with many labels and textboxes in rows and cols using css.
Im looking for examples to start to buld it.It is a registration page kinda , therefe=ore a a lot of info required with several kinds of controls in it.
Can yo provide an excellent layout to to start with?  Perhaps a few lines for rows and cols. thanks
0
 
LVL 6

Expert Comment

by:lightspeedvt
ID: 39279644
Seems that should be posted as another question, as I haven't excellent layout that will help you to start with.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question