Cast by my silhouette on the edge of my screen

My webpage has a right sidebar and I am looking to add a subtle shadow on the left side of it. I want the shadow to resemble the one found on the Google Maps left sidebar (). Is this something that can be achieved?

For reference, here is a link to a jsFiddle: http://jsfiddle.net/yhfXX/3/

In the ideal scenario, the sidebar should take up the full height, although the example provided in the jsFiddle is just for demonstration purposes.

Thank you!

Answer №1

Using the box-shadow CSS property allows you to add a drop shadow effect to elements.

#sidebar {
  -moz-box-shadow:    -3px 0 5px 0 #555;
  -webkit-box-shadow: -3px 0 5px 0 #555;
  box-shadow:         -3px 0 5px 0 #555;
}

Check out a DEMO here

This is how it works:

  1. The horizontal offset: Determines the position of the shadow from left to right of the element.
  2. The vertical offset: Positions the shadow above or below the element.
  3. The blur radius (optional): Adjusts the blurriness of the shadow, with higher values creating more blur.
  4. The spread radius (optional): Controls the size of the shadow, either increasing or decreasing it relative to the element.
  5. Color: Specifies the color of the shadow.

View the table for Box-shadow support across browsers

Answer №2

Here is an example of CSS3 inset shadow:

.shadow {
   -moz-box-shadow:    inset 0 0 10px #000000;
   -webkit-box-shadow: inset 0 0 10px #000000;
   box-shadow:         inset 0 0 10px #000000;
}

Feel free to modify the size (10px) as per your requirement

Answer №3

The following code is not compliant with W3C standards:

.shadow {
   **-moz-box-shadow:    inset 0 0 10px #000000;**
   **-webkit-box-shadow: inset 0 0 10px #000000;**
   box-shadow:         inset 0 0 10px #000000;
}

Answer №4

To achieve this effect, try implementing CSS like the following:

text-shadow: 0px 3px 2px rgba(0, 0, 0, 0.5);

Play around with different values to customize it to your liking!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a way to refresh a specific element without having to reload the entire page when the button is clicked

While working on a rock, paper, scissors game in JavaScript, I found it tedious to have to constantly reload the page after each play. To solve this issue, I attempted to add a button that would reset the game for a new round. However, I encountered an err ...

"Exploring the world of remote_form_tag in Rails with jrails

After transitioning to jQuery with jRails for my application, most of my previous RJS code is working perfectly. However, I am facing an issue with the :loading => callback when using the remote_form_tag. <% form_remote_tag :url => '/hostels ...

Move the aircraft across the display in a lively animation

I need help creating an animation where a plane flies across the screen, exits from the left side, and re-enters from the right side in a continuous loop. How can I achieve this effect to make the plane fly endlessly across the screen? Here is my code: ...

Fixed first column in a spacious data grid

The layout I have created can be viewed in the Fiddle http://jsfiddle.net/5LN7U/. <section class="container"> <section class="field"> <ul> <li> Question 1 </li> <li> question 2 </ ...

Comparing the distinct characteristics of the <a> tag and the GET request

I have a somewhat simple inquiry. Can someone please explain the distinction between an <a> tag and a standard GET request with any element? I understand that the <a> tag automatically redirects to the URL specified in its href attribute. As su ...

JavaScript code: "Retrieve the div element and append metadata to the HTML file

Currently, I am utilizing the subsequent technique to save a target tag on my webpage as an HTML file. function retrieveHtml(filename, elId, format) { var htmlEl = document.getElementById(elId).innerHTML; if (navigator.msSaveBlob) { // IE 10+ ...

Bone Structure Styles - adaptable form

I'm currently working on a form using skeleton css and initially set it up with a three-column layout. However, I found that this created too much white space due to varying content lengths in each column. I would like to switch to a horizontal layout ...

"Preventing the default behavior with e.preventDefault is causing issues with the functionality of my

I'm struggling with getting a form to send its contents via email using ajax to display a thank you message without reloading the page. When I remove preventDefault() from the JS, the form sends correctly but redirects to the PHP file, which is not id ...

What are the implications of using :root along with the universal selector in CSS to overwrite Bootstrap variables?

As I work on theming my website, which utilizes Bootstrap, I am making adjustments to the Bootstrap variables. Some variables are defined against the :root element in a way that allows me to easily override them: :root { --bs-body-color: red; } Howeve ...

Unable to retrieve the information through the use of the openWeatherMap API in JavaScript

Having trouble pinpointing the issue as nothing is being displayed in the selected div. $(document).ready(function(){ var lat, lng, data; // Retrieve current location if (navigator.geolocation) { navigator.geolocation.getCurrentPositio ...

How can the output directory of the CSS file generated by Compass/Webby be modified?

I need assistance in getting my *.css file to be outputted in the output/css directory instead of the stylesheets directory. How can I achieve this? Here's what I've already attempted: Compass.configuration do |config| config.project_path = F ...

What is the process for creating a tab logo?

Is there a way to create a personalized logo to appear next to the website title on the tab? Whenever I see a logo displayed beside the website title in my browser tabs, I can't help but wonder how it's done. ...

What is the reason for initializing this Knockout.js component in a seemingly random order?

I am feeling completely lost... Currently, I am working on creating a list using Knockout.js components, templates, and custom elements. However, I am facing an issue where the steps I define in my Viewmodel are being initialized in a random order within ...

Alignment of Bootstrap thumbnails in a horizontal layout

After adding the thumbnail class to my thumbnails div, I noticed that some of the thumbnails were smaller in size than others. Wanting them all to have the same height, I decided to give each thumbnail a fixed height of 210px. However, this caused the sm ...

Is there a way to make the text scroll up automatically when it overflows?

I have a straightforward div element that occupies the header's height but currently has a fixed height of 400px for testing purposes. Here is how it currently appears: https://i.sstatic.net/gg6kQ.png I am utilizing the type-it library to dynamical ...

The compatibility of JQuery MVC with Internet Explorer

Sheesh, folks, I've got a real head-scratcher of an issue on my hands. Running my webapp in Firefox has been smooth sailing, but now my client wants to use Internet Explorer. Simply telling them to switch browsers is not a viable solution for me, so I ...

Utilizing CSS to dynamically update SVG icons within the navigation menu upon tab selection

Feeling frustrated and in need of assistance with my current issue. I am attempting to make a change - when I click on a tab in the menu, the default black SVG icon should be replaced by a white one. #menu a .main-menu-icon { display:inline-block; width:2 ...

What is the best way to halt an event using jQuery?

My question is about handling events on a webpage. I am interested in triggering a jquery method when the user clicks a link to navigate away from the page. In this method, I need to perform some checks before allowing the user to leave, so I plan to use: ...

Challenge: Integrate jQuery into Wordpress while converting a Bootstrap template

I am facing an issue with loading jQuery files from a Bootstrap template while converting it into a Wordpress theme. Despite trying various methods of enqueuing scripts in my functions.php file and even de-registering jQuery, the problem persists. Upon in ...

What is the best way to trigger a controller action using jQuery in your application.js file?

Currently, I am incorporating the jQuery autocomplete plugin into my project and looking to personalize a specific event: select: function(event, ui) { $('.topic_field').val(ui.item.topic.name); return false; This event es ...