[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

css repeat-x

Posted on 2010-11-29
7
Medium Priority
?
853 Views
Last Modified: 2012-05-10
Hi,

I was reading like

By default, the background-image property repeats an image both horizontally and vertically.

Some images should be repeated only horizontally or vertically, or they will look strange. And I was running following code as well
<html>
<head>
<style type="text/css">
body
{
background-image:url('gradient2.png');
background-repeat:repeat-x;
}
</style>
</head>

<body>
<h1>Hello World!</h1>
</body>

</html>

Open in new window



I have not understood

what

background-repeat:repeat-x;

will do.

Does that mean the image repeats 2, 3 times etc entire length or width of page. how much distance it will keep between first and second repeated image and between 2nd and 3rd images.Please advise. Any links, sample code, resoureces, ideas highly appreciated. thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 18

Accepted Solution

by:
Sudaraka Wijesinghe earned 1000 total points
ID: 34236350
From what you have posted I think you are following the w3schools tutorial?
There are examples there you can play around with like:
http://www.w3schools.com/css/tryit.asp?filename=trycss_background-image_gradient2

background-repeat does just that, it make the background image (if smaller than end size of the elements it's used in) repeat it self along x, y or both axis.

Does that mean the image repeats 2, 3 times etc entire length or width of page
Yes, it repeats until entire height and/or width of the element is filled. This can be used in any HTML block element not just the page body.

how much distance it will keep between first and second repeated image and between 2nd and 3rd images
There's no space between repeated images and we can't control that (as of CSS2)

0
 
LVL 3

Assisted Solution

by:deegoy418
deegoy418 earned 400 total points
ID: 34237595
background-repeat:repeat-x;

it will repeat the background image horizontally and it will apply across the width of the page. there will be no space between the images.

let me know if you have further question or still not understand.

thanks
0
 
LVL 8

Assisted Solution

by:Zado
Zado earned 200 total points
ID: 34237694
'repeat-x' value:
- image repeated horizontally;
- image is at the top of page;
- no spaces between repeated images;
- image repeated in whole lenght of the page (100%);

Learn more here:
http://www.w3.org/TR/CSS2/colors.html#propdef-background-repeat
And learn everything about background here:
http://www.w3.org/TR/CSS2/colors.html
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:deegoy418
ID: 34237800
this is what I answered.
0
 
LVL 8

Assisted Solution

by:Alicia St Rose
Alicia St Rose earned 400 total points
ID: 34244837
Since I'm directionally challenged, ;), a good way to remember which way is which:

repeat-x - repeats the image aCROSS like the X symbol for crossing.
repeat-y - repeats image up and down. The stem of the Y points down!

The online tutorials are great!
But let me suggest to you an awesome book to go along with those:

The Head First Guide to HTML with CSS and XHTML by Freeman and Freeman.

You can find it on Amazon and it has RAVE reviews.
Don't let the HTML in the title fool you. It's an amazing beginners CSS book. It builds a wonderful foundation and emphasizes web standards
I owe my livelihood to that book! It's a fun and clever way to learn a difficult subject.
You'll feel like a whiz after reading it.

Enjoy!

0
 
LVL 8

Expert Comment

by:Zado
ID: 34317465
Please grant the points and close the question, thanks :-)
0
 
LVL 8

Expert Comment

by:Zado
ID: 34384853
To be clear here: I'm not asking for grant the points to me, but generally.
If you have a problem with any suggestion from experts or nothing works with your expectation, please let us know, so we will continue work on solution for you, thanks.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

649 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