Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
This is an angular app that displays a list of movies.
Link to plunker here: https://plnkr.co/edit/nSpPKefitlnDjoev3b0w?p=preview
In short, there are 6 elements in the ng-repeat loop to display the movies, and they are placed one next to the other with no margin, but with varying widths and colors depending on the order in which they appear(based on my limited understanding).
Index.html:
<div class="main" ng-controller="MainController">
<div class="container">
<div class="content">
<div ng-repeat="show in shows">
<div class="rank">{{$index + 1}}</div>
<div class="img_container">
<img class="img-responsive" ng-src="{{show.series_img}}">
</div>
<h2 class="series">{{show.series}}</h2>
<p class="genre">{{show.genre}}</p>
<p class="run-start">{{show.run_start}}</p>
<p class="description">{{show.description}}</p>
</div>
</div>
</div>
</div>
The interaction of these rules is what I find particularly confusing:
div.ng-scope:nth-child(odd) h2 {
width: 400px;
}
div.ng-scope:nth-child(even) p+p {
width: 400px;
}
p {
background: #f9f9f9;
display: block;
float: left;
font-size: 18px;
height: 200px;
margin: 0;
padding: 30px;
width: 200px;
}
div.ng-scope p+p {
background: #e5e5e5;
}
div.ng-scope p+p+p {
background: #000;
color: #fff;
font-size: 14px;
width: 800px;
}
I would also appreciate any links to tutorials explaining how ng-scope works in this context.
div.ng-scope selects the <div ng-repeat="show in shows"> element because the ng-repeat adds the ng-scope class to the element when it renders.
nth-child(odd) and nth-child(even) set the styles of the odd and even children of the elements' respective containers, respectively.
p affects all <p> elements, while p+p affects all <p> elements following immediately after another <p> element. p+p+p affects all <p> elements immediately following two <p> elements.
Check out this article for more information about the plus symbol in css: What does the "+" (plus sign) CSS selector mean?
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last month.
Improve this question
I have no idea about CSS, please help me to write CSS to make look the list items as in the image. These are 3 list items here but it's dynamic. I tried to play around with but it's the last time I am working with CSS so I do not want to put too much into it, what looks like fairly simple task. Please help.
This is how I want it to look
li {
display: flex;
list-style: none;
}
.style {
padding: 3px 10px;
border-radius: 10px;
background-color: #15dfc8;
margin-right:20px;
}
Something like this:
It will look more like you want it when the fonts from your site are applied
.lines, .line{
display:flex;
}
.lines{
flex-direction: column;
gap: 10px;
}
.line{
align-items: center;
gap: 5px;
}
.number{
padding: 3px 10px;
border-radius: 10px;
background-color: #15dfc8;
}
<div class="lines">
<div class="line">
<div class="number">45</div>
<div class="text">Fit (Very Good)</div>
</div>
<div class="line">
<div class="number">46</div>
<div class="text">Fit (Very Good)</div>
</div>
<div class="line">
<div class="number" style="background-color: lightgray;">47</div>
<div class="text">Fit (Good)</div>
</div>
</div>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I can't seem to find the answer to this question.
I am trying to change the text color of the words "Pro Tip" in this code
<div style="background-color: #f7f7f7; padding: 1.0em; max-width: 45.0em; margin: 1.0em 0; border: solid 1.0px #cccccc;">
<strong><text-color-#ff9800&g>tPRO TIP</></> -
</strong> Text 2
</div>
NO matter what I Google nothing works. How can I figure it out? Also how can I write the code that fixes this?
https://www.screencast.com/t/U6KqJ9dIHVu
You can use the CSS property color to style the <strong> element.
<div style="background-color: #f7f7f7; padding: 1.0em; max-width: 45.0em; margin: 1.0em 0; border: solid 1.0px #cccccc;">
<strong style="color: #ff9800;">PRO TIP -
</strong> Text 2
</div>
You should remove &g from hex color. And there is no valid tag like text-color. That's why you should use style attribute in strong tag. font is not supported by HTML5. so better ignore it. Here this code works perfectly.
<div style="background-color: #f7f7f7; padding: 1.0em; max-width: 45.0em; margin:
1.0em 0; border: solid 1.0px #cccccc;">
<strong style="color:#ff9800">tPRO TIP</></> -
</strong> Text 2</div>
The structure of what the code you have makes it hard to read and use. The attribute you need to target to change the colour of your text is 'color'. As you're using inline styles rather than a CSS stylesheet I'd use this instead:
<div style="background-color: #f7f7f7; padding: 1.0em; max-width: 45.0em; margin: 1.0em 0; border: solid 1.0px #cccccc;">
<div style="font-weight: bold; color: #ff9800">
<p>PRO TIP</p>
</div>
<div>
<p>Your text here</p>
</div>
</div>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
Locally the progress bars shows up. but when hosted it only shows the percentage text.
So far when hosted locally everything works fine but I can't seem to find the problem when hosting it on a website, no errors are given either.
I'd like it to show up when I'm actually visiting the website. But for now it shows only the text between the span tags.
Inline css and seperate .css file.
#skills{
width:100%;
height:20px;
border:1.2px
solid black;
}
#HTML {
width: 90%;
background-color: #c5e5ef;
height: 20px;
text-align: center;
position: relative;
}
#PHP {
width: 71%;
background-color: #c5e5ef;
height: 20px;
text-align: center;
}
#MySQL {
width: 66%;
background-color: #c5e5ef;
height: 20px;
text-align: center;
}
#CSS {
width: 88%;
background-color: #c5e5ef;
height: 20px;
text-align: center;
}
#Java {
width: 45%;
background-color: #c5e5ef;
height: 20px;
text-align: center;
}
<p>HTML</p>
<div id="skills">
<div id="HTML"><span style="color: black;"><b>90%</b></span>
</div>
</div>
<br>
<p>PHP</p>
<div id="skills">
<div id="PHP"><span style="color: black;"><b>71%</b></span>
</div>
</div>
<br>
<p>MySQL</p>
<div id="skills">
<div id="MySQL"><span style="color: black;"><b>66%</b></span>
</div>
</div>
<br>
<p>CSS</p>
<div id="skills">
<div id="CSS"><span style="color: black;"><b>88%</b></span>
</div>
</div>
<br>
<p>Java</p>
<div id="skills">
<div id="Java"><span style="color: black;"><b>45%</b></span>
</div>
</div>
This is clearly just a browser caching issue, as it seems to work in the code snippet you included above.
To avoid this kind of issues in the future, try developing the habit of refreshing using Ctrl+F5 while changing HTML & CSS code in your web pages, which forces the browser to redownload and parse your page.
Just a note: you should be using Classes to assign CSS to your Div blocks instead, and ID attributes should be unique, as they're generally used in JavaScript to retrieve and manipulate the contents of said blocks
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
i have one problem .I can not give each one a particular style.help meenter image description here
You need to use :nth-of-type(n) selector.
// For First Right Class Div
#container .right:nth-of-type(1) {
}
// For First Left Class Div
#container .left:nth-of-type(1) {
}
Hence for every div you need to change n value.
Your question is extremely unclear but I want to help you out anyhow. I assume you want to style each div inside the container individually, rather than styling all of ".left" and ".right".
To do this, you can add multiple classes to each div;
.right {
color: red;
}
.left {
color: blue;
}
.r1,
.l3{
color: green;
}
<div id='container'>
<div class='right r1'>r1</div>
<div class='right r2'>r2</div>
<div class='right r3'>r3</div>
<div class='right r4'>r4</div>
<div class='left l1'>l1</div>
<div class='left l2'>l2</div>
<div class='left l3'>l3</div>
<div class='left l4'>l4</div>
</div>
In the example above I have changed the class in, for example, the xth 'left' to 'left lx'. We can then individually style the divs.
You could also use the ":nth-child" selector, as seen below:
.right {
color: red;
}
.left {
color: blue;
}
#container div:nth-child(7),
#container div:nth-child(1) {
color: green;
}
<div id='container'>
<div class='right'>r1</div>
<div class='right'>r2</div>
<div class='right'>r3</div>
<div class='right'>r4</div>
<div class='left'>l1</div>
<div class='left'>l2</div>
<div class='left'>l3</div>
<div class='left'>l4</div>
</div>
Hope this helps!
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
As you can see the text is not properly aligned.
I want the text to be displayed like these and it should be justified also:
Ethics/Moral:Respect for mankind,the environment and fglll
nature without exceptionRespect for mankind,the
environment and nature without exception
The next line should start at the same point as the previous line.
How can I do it in css
#MuFFes mentioned the css properties text-indent, but I prefer to use dl, dt, and dd elements.
dt {
float: left;
clear: left;
width: 100px;
text-align: right;
font-weight: bold;
}
dt:after {
content: ":";
}
dd {
margin: 0 0 0 110px;
padding: 0 0 0.5em 0;
}
<dl>
<dt>Ethics/Moral</dt>
<dd>Respect for mankind, the environment and nature without exception.</dd>
<dt>Honesty</dt>
<dd>Treating everyone with sincerity and integrity.</dd>
<dt>Quality/Safety</dt>
<dd>Mankind and the environment, the product and its utilization -achieving the optimum together.</dd>
</dl>
By using flex you can do like this
Note, the br I added is merely there to show how it behaves when breaking line
.row {
display: flex;
}
.row ~ .row {
margin-top: 5px;
}
.row div:first-child {
color: steelblue
}
<div class="row">
<div>
Ethics/Moral:
</div>
<div>
Respect for mankind, the environment and<br>nature - without exception
</div>
</div>
<div class="row">
<div>
Honesty:
</div>
<div>
Treating everyone with sincerity and<br>integrity
</div>
</div>
and if you need 2 even columns and have dynamic content, use display: table-row/table-cell
.row {
display: table-row;
}
.row div {
display: table-cell;
}
.row ~ .row div {
border-top: 10px solid transparent;
}
.row div:first-child {
color: steelblue
}
<div class="row">
<div>
Ethics/Moral:
</div>
<div>
Respect for mankind, the environment and<br>nature - without exception
</div>
</div>
<div class="row">
<div>
Honesty:
</div>
<div>
Treating everyone with sincerity and<br>integrity
</div>
</div>
Side note:
As Paulie D very well pointed out, dl/dt/dd is likely the most semantically appropriate markup, though my suggested styling might give you the wanted result. Feel free to combine the two
I think that using ::first-line pseudoelement is the best you can do in that case. Try:
::first-line {
text-indent: -40px;
}
You have to adjust text-indent by yourself.
It would be also a little bit easier with the sample of your code.