How can I add some css to center certain divs if they are using the same css style? [duplicate]
Tags: html,css
Problem :
This question is an exact duplicate of:
I'm trying to keep the same styles (summary-description and summary-headline). I would want the divs that include Apple, Banana and Carrot text to all be centered.
I would want to keep the Watermelon text to be aligned left.
How would I accomplish this?
Check out my jsfiddle: http://jsfiddle.net/p28Qz/12/
HTML
<div id="wrapper-threecol">
<div id="threecol_row">
<div class="threecol_cell1">
<p class="summary-headline">Apple</p>
<p class="summary-description">Apple designs and creates iPod and iTunes, Mac laptop and desktop computers, the OS X operating system, and the revolutionary iPhone and iPad</p>
</div>
<div class="threecol_cell2">
<p class="summary-headline">Banana</p>
<p class="summary-description">Apple designs and creates iPod and iTunes, Mac laptop and desktop computers, the OS X operating system, and the revolutionary iPhone and iPad</p>
</div>
<div class="threecol_cell3">
<p class="summary-headline">Carrot</p>
<p class="summary-description">Apple designs and creates iPod and iTunes, Mac laptop and desktop computers, the OS X operating system, and the revolutionary iPhone and iPad</p>
</div>
</div>
</div>
<div class="wrapper-data">
<div class="data_row">
<div class="data_cell1_lt">
<p class="summary-headline">Watermelon</p>
<p class="summary-description">We here at the National Watermelon Promotion Board have one goal: to increase consumer demand for fresh watermelon through promotion.</p>
</div>
<div class="data_cell2_lt"> </div>
<div class="data_cell3_lt">
<img alt="New Search Field" height="273" src="http://www.juicing-for-health.com/wp-content/uploads/2012/06/watermelon.jpg" width="420" />
</div>
</div>
</div>
CSS
#wrapper-threecol {
position:relative;
width:100%;
border: none;
margin: 20px 0 37px 0;
}
#threecol_row {
height:100%;
white-space:nowrap;
}
.threecol_cell1, .threecol_cell2, .threecol_cell3 {
height:100%;
width:30%;
display:inline-block;
white-space:normal;
vertical-align: top;
margin-left: 5%;
}
.threecol_cell1 {
margin-left: 0;
}
.summary-headline {
color: #232323;
font-family: Helvetica, Arial, sans-serif;
font-size: 20px;
line-height: 24px;
margin:0 0 10px 0;
text-align: left;
}
.summary-description {
color: #232323;
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 23px;
margin: 0;
text-align: left;
}
.wrapper-data {
position:relative;
width:100%;
border: none;
margin: 40px 0 0 0;
overflow: hidden;
}
.data_row {
height:100%;
min-height:100%;
white-space:nowrap;
display:table;
width: 100%;
}
/* Landing Data - Left Content */
.data_cell1_lt {
width:47%;
white-space:normal;
display:table-cell;
vertical-align:middle;
}
.data_cell2_lt {
width:6%;
display:table-cell;
white-space:normal;
}
.data_cell3_lt {
width:47%;
display:table-cell;
white-space:normal;
}
.data_cell3_lt img {
display:block;
margin:0 auto;
}
.data_cell3_lt p {
text-align:center;
}
Solution :
Add just this simple rule to your stylesheet:
#threecol_row p {
text-align: center;
}
FIDDLE: http://jsfiddle.net/p28Qz/14/
CSS Howto..
check this updated fiddle You basically need to mark the selected message with class 'selected' $(this).addClass("selected").siblings().removeClass("selected"); and then remove that class only $("#yes").one("click", function(){ $(".mesaj.selected").remove(); $("#delPop").hide(); }); $("#no").one("click", function(){...
If you want to use native Javascript, getElementsByClassName() is the way to go. It should be noted, however that this returns a collection of elements, like an array. You can...
You can try this: https://jsfiddle.net/dqhx5cf5/ HTML: <div class="rectangle"><div class="circle"></div></div> CSS: .rectangle{ background-color: darkblue; width: 300px; height: 500px; overflow:hidden; } .circle{ border-radius: 50%; width: 600px; height: 600px; background-color: #ddd; position:relative;...
For this the iframe src document should also have to be on same domain to access iframe's dom nodes, if you have both pages on same domain then you can...
no need to add <?php ?> code in the header file just keep it as it is : Create a new file named header.php and add this code to it...
It sounds like this can and should be done with CSS, but you might've left out an important bit. For text-indent to function properly the element can't be set to...
It's hard to answer your question without knowing exactly what you're trying to do, but I suspect you are trying to make the spans stay side-by-side at any window size,...
In the JSFiddle at least, the problem seems to be occurring just because of this line: <div class="login">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div> Because there are no spaces in there, the browser wants to keep...
Consider this approach, using data URLs: http://stackoverflow.com/a/9971339/36537 Essentially you create a 1px wide canvas, set the values from the banner pixels, and convert this to a data URL. Pass this...
You can remove height and set overflow: auto : div#mktContent { background:#fff; overflow:auto;/*Replace height with overflow*/ position: relative; } fiddle...
You define position: absolute; on .MidBody, #rightbody, and #leftbody, which removes them from the document flow and allows the footer to drift up to the navigation links. Change these to...
Use a div with a image as background, then let the other image (and the header's content, if you have it) inside the div. Example: body { width: 100%; height:...
jQuery animate method doesn't recognize webkit transform property, you can use jQuery plugins that support this feature, try jQuery Transit.
The width on your hover is causing the jump. I moved it to the "a" tag and cleaned up the other code a bit as well: #city-navigation li a {...
I'll show you have you can achieve this for the first a tag. You can replicate the same for the remaining. Change the CSS to assign those properties to another...
Just cascade them .main-tab-list.active{color:red;} This ensures that only .main-tab-list which are active will be selected. Other classes who also have .active class on it won't be affected. It simply says,...
Your divs have no height, so they do not do much currently. Fiddle .select_3_left{ float: left; width: 30%; height:100px; background: red; } .select_3_middle{ float: left; width: 30%; height:100px; background: green;...
You can do this using the CSS3 property box-shadow. Add the following to your CSS: box-shadow: 0px 0px 0px 5px #f00; jsFiddle example...
Basically what you needed to do was to use the css properties 'float' and 'clear'. Check out this JSFiddle here. for this example i just targeted all the div's as...
Isotope might do the job for you. Or you can simply use Bootstrap grids.
you can do this for the whole Liferay instance by specifying theme.css.fast.load=false in your portal-ext.properties file. However, if it's for verification pupose, you can just add css_fast_load=0 in your request...
You could also do something like this... div[id="xxx.yyy"] { /* your styles here */ } The spec says it all: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier jsFiddle: http://jsfiddle.net/UnsungHero97/mjGzQ/...
CSS's font-family doesn't allow specifying more than one generic font keyword in a single font family name, so you'll either have to go with monospace or sans-serif.
To expand on my comment, you can't do it semantically. You have to use a little trick to fake the 100% height. It's called faux columns, and you can read...
Dreamweaver is not a dependable tool for previewing HTML. Always preview it in the browser. Dreamweaver will give you an approximate representation, but it will never be 100% accurate, especially...
Hi now used to this as like this div{ white-space: pre-wrap; /* CSS3 */ white-space: -moz-pre-wrap; /* Firefox */ white-space: -pre-wrap; /* Opera <7 */ white-space: -o-pre-wrap; /* Opera 7...
This should work in IE: $("head").append("<link rel='stylesheet' type='text/css' href='/inc/body/jquery/css/start/jquery-ui-1.8.10.custom.css' />"); ...
submit_tag generates the text as the value attribute of the input tag. submit_tag "Edit this article" # => <input name="commit" type="submit" value="Edit this article" /> So adding strong to that...
The problem is with the following CSS rule: .carousel img { position: absolute; width: 100%; height: auto; } This will affect both the main image and each thumbnail, resulting in...
Just wrap each group of label+input in some div. ul { margin: 0; padding: 0; list-style-type: none; } .wrap { display: inline-block; } label { display: block; text-align: center; }...