Solved

Css to add margin to column

Posted on 2013-06-26
3
372 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 225 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Seems that should be posted as another question, as I haven't excellent layout that will help you to start with.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Website Home page blank 4 25
CSS grid style change 2 13
Bootstrap input box width 2 12
How do i remove the outer scrollbar? 2 17
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now