How is this specific design effect achieved? [closed] - html

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
On this site, http://kickpoint.ca/, there is a little red triangle underneath the main red section at the top
I cant for the life of me work out how it is done. I've used Chrome dev tools and cant see where it is defined.
Anyone know how it is achieved or if there is a standard way of achieving this effect?

CSS Triangles.
CSS
.arrow-down {
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #f00;
}
HTML
<div class="arrow-down"></div>
Resource
More info can be found here

Here's a link from CSS tricks on how to do it: http://css-tricks.com/speech-bubble-arrows-that-inherit-parent-color/
Google is your friend ;)

It uses CSS to make triangles. The basic concept of creating a triangle is to set the border of div on one side to form the base. The adjacent border is left blank and the borders perpendicular to the base are set to transparent. A good explanation of CSS triangles can be found here: http://css-tricks.com/snippets/css/css-triangle/
HTML
<div class="pointer">
<div class="inner"></div>
<div class="arrow"></div>
</div>
CSS
.pointer{
width: 100px;
}
.pointer .inner {
height: 25px;
background: red;
}
.pointer .arrow{
border-top: 10px solid red;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
width: 0px;
margin: 0px auto;
}
Working Example: http://jsfiddle.net/JYM8w/

Related

If you get a chance, could you please help me improve my HTML and CSS codes for border style dash with black background? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 months ago.
Improve this question
I was able to achieve the overall design but I am a bit worried about the way I code because I am aware that I am not using the best practice.
These are my codes:
#formatting {
text-align: center;
padding: 25px;
padding-top:10px;
padding-bottom:10px;
display:inline-block;
color:#ffffff;
}
.thindash {
background: #000000;
border: 2px dashed #ffffff;
position: relative;
}
.thindash:after {
content: '';
position: absolute;
left: -1px;
top: -1px;
right: -1px;
bottom: -1px;
border: 1px solid #000000;
pointer-events: none;
}
</style>
<div style="background: #000000; padding: 15px; display: inline-block;">
<div class='thindash' id="formatting">
<h3>Working Hours</h3>
<p>Monday to Friday</p>
<p>8 AM - 12 PM (Lunch - Dinner)</p>
<p>8 AM - 11 AM (Morning Breakfast)</p>
</div>
</div>```
You are unlikely to get someone to clean your code. However I can provide a couple of tips regarding the code above.
Don't use inline styles on your outer <div>. Use a class instead.
Unless you have a specific reason to do so which is not obvious from the code above, do not use an id for styling #formatting. Either use the thindash class you already have or make formatting a class rather than an id.
You don't need to use padding, padding-top and padding-bottom on #formatting. padding is shorthand for padding-top padding-right padding-bottom padding-left. Presumably you want 25px padding on the left and the right and 10px bottom and top. As such you can just write padding: 10px 25px. That will give you 10px top and bottom and 25px left and right. More information on padding.
Don't get too frustrated; read articles and tutorials (there's tonnes of free resources online); and keep practising.

How to make triangle div above a rectangle div? [closed]

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 2 years ago.
Improve this question
I'm trying to create a Triangle on top of a rectangle div. The triangle needs to be the width of the page and also be responsive. The upper right and left parts of the div (where no triangle exists) needs to be transparent.
I have an image of what it should look like but it's very difficult to see due to the similar dark colors. The upper right and left of the rectangle div needs to be transparent.
Does anyone know how I can recreate the highlighted rectangle in the image below?
I've been trying for hours by searching through stackoverflow and haven't been able to figure it out from other questions.
Thank you!
You can try that :
<html>
<body>
<style>
body {
margin: 0;
}
.rectangle {
width: 100%;
height: 100px;
background: #777;
}
.triangle-up {
width: 0;
height: 0;
border-left: 50vw solid transparent;
border-right: 50vw solid transparent;
border-bottom: 100px solid black;
}
</style>
<div class='rectangle'>
<div class='triangle-up'></div>
</div>
</body>
</html>
(I changed the colors to make it easier to see)

Draw a border line for a specific width [closed]

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 5 years ago.
Improve this question
I want to bring my Sketch file to HTML/CSS in the browser.
How can I implement the white line just between the small and big text, as shown in the image below?
If don't want to include any additional html element then you can use pseduo element:after.
h2:after {
display:block;
content:" ";
width: 80px;
height: 5px;
background: grey;
margin-top: 5px;
}
fiddle
You can add an empty div with a bottom border & custom width, which is of cleaner and shorter code:
body {
background-color: blue;
color: white;
}
#mydiv {
border-bottom: 4px solid white;
width: 33%;
}
#myline {
height: 4px;
background-color: white;
border: 0px solid black;
width: 33%;
}
A div:
<div id="mydiv"></div>
A horizontal line:
<hr id="myline" />
That's 4 lines for the HR and 2 for the div, and that's without making the hr align to the left.
If you don't want to add another element you can use ::after on any element - just make it have display: block and set the color, width, height etc. similar to the above code.
You can add tag <hr> and him specify needed width, height,color...

Need help placing a border at top and bottom of navbar [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Ive tried for hours to get a border at the top and bottom of my navbar.
http://www.rubricdesign.co.uk/ http://www.rubricdesign.co.uk/style.css
Your font-size is too big for the <nav>. That's what's happening. Plus all the unnecessary floats. Here's a link to get you back to the start and you can style from here: http://jsfiddle.net/disinfor/ypL8n/1/
use css:
#navi {
border-top: solid 1px black;
border-bottom: solid 1px black;
}
Use this:
CSS
border-top:1px solid #FFFFFF;
So it's border-top: ( thickness ) ( type of line ) ( color )
use css:
.navbar {
border-top: solid 1px black;
border-bottom: solid 1px black;
}
Also you have given it a set height remove that

How can you make a shape in html with css [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How can you make shapes using a single HTML element? Any CSS technique can be used as long as it's supported in at least one browser.
Examples of shapes would be a round shape, a triangle, six-angled and so on.
http://css3shapes.com/ has instructions on how to make a lot of shapes in CSS.
But seriously, there are better solutions to drawing shapes in the browser than using CSS.
Most of the shapes shown in the site above only work in modern browsers because they use CSS3 techniques that aren't available in browsers like IE8. (So if you want to do this in old versions of IE, the answer is forget about it).
But the same browsers that support those shapes also all support other technologies like SVG, which allow you to draw any shapes you like, without the restrictions of working around a box shape.
So the short answer is yes, it can be done, but SVG will give you much better results.
I have made this fiddle with some pure html/css shapes:
- 2 triangles using a span border
- a circle with the help of border-radius
Disclaimer: I was inspired from the old google application/menu bar.
Source:
html
An CSS triangle pointing down:
<span class="delta_down"></span><br>
An CSS triangle pointing up:
<span class="delta_up"></span><br>
Circle:
<span class="circle"></span>
css
span.delta_down {
border-color: #C0C0C0 transparent transparent;
border-style: solid dashed dashed;
border-width: 5px 5px 0;
display: inline-block;
font-size: 0;
height: 0;
line-height: 0;
padding-top: 1px;
position: relative;
top: -1px;
width: 0;
}
span.delta_up {
border-color: transparent transparent #C0C0C0;
border-style: dashed dashed solid;
border-width: 0 5px 5px;
display: inline-block;
font-size: 0;
height: 0;
line-height: 0;
padding-top: 1px;
position: relative;
top: -1px;
width: 0;
}
span.circle {
border-radius: 50%;
width: 10px;
height: 10px;
display: inline-block;
background-color: #C0C0C0;
}
This is not possible with pure HTML and CSS. But you can use a canvas element and draw all shapes with JavaScript.
This basic tutorial may help you.