homepage Welcome to WebmasterWorld Guest from 54.234.128.25
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Style 3 then miss 3 then style 3
greencode




msg:4563440
 9:55 am on Apr 10, 2013 (gmt 0)

I've used a layout which has a grid of 3 blocks by an infinite number of rows. Is there any way that I can style the first 3 blocks, miss the next 3, style the next 3 etc etc?

I've used :nth before but not sure it can do this?

Any help would be greatly appreciated.

 

drhowarddrfine




msg:4563469
 11:42 am on Apr 10, 2013 (gmt 0)

Yes, (n+3) can do that, but I just woke up and can't think.

birdbrain




msg:4563477
 12:37 pm on Apr 10, 2013 (gmt 0)

Hi there greencode,

actually, this will need; (6n+1), (6n+2) and (6n+3). ;)

Here is an example....


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">

<title>every other row</title>

<style type="text/css">
body {
background-color:#f0f0f0;
font-family:verdana,arial,helvetica,sans-serif;
font-size:1em;
}
ul {
width:462px;
padding:2px;
margin:20px auto 0;
border:1px solid #999;
background-color:#fff;
box-shadow:10px 10px 10px rgba(0,0,0,0.5);
list-style-type:none;
overflow:hidden;
}
li {
float:left;
width:148px;
margin:2px;
border:1px solid #000;
background-color:#666;
color:#fff;
}
li:nth-child(6n+1),li:nth-child(6n+2),li:nth-child(6n+3){
border-radius:5px;
border-color:#999;
background-color:#fff;
box-shadow:inset 0 0 10px rgba(0,0,0,0.3);
line-height:2.0em;
font-family:georgia,'times new roman',serif;
font-size:1.5em;
font-weight:bold;
color:#000;
text-align:center;
}
</style>

</head>
<body>

<ul>
<li>row 1</li><li>row 1</li><li>row 1</li>
<li>row 2</li><li>row 2</li><li>row 2</li>
<li>row 3</li><li>row 3</li><li>row 3</li>
<li>row 4</li><li>row 4</li><li>row 4</li>
<li>row 5</li><li>row 5</li><li>row 5</li>
<li>row 6</li><li>row 6</li><li>row 6</li>
<li>row 7</li><li>row 7</li><li>row 7</li>
<li>row 8</li><li>row 8</li><li>row 8</li>
<li>row 9</li><li>row 9</li><li>row 9</li>
</ul>

</body>
</html>



birdbrain

greencode




msg:4563492
 1:20 pm on Apr 10, 2013 (gmt 0)

Fantastic, that works beautifully. Thanks for your help.

birdbrain




msg:4563497
 1:30 pm on Apr 10, 2013 (gmt 0)

No problem, you're very welcome. ;)


birdbrain

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved